Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Returning Parts of a Mutable Borrow Triggers the Borrow Checker
Hey all!
I'm currently working on an swc
plugin which replaces parts of a JavaScript DOM.
I came to realize that working with swc
s complex data structures involving nested Box
es and enum
s which must be match
ed against is quite cumbersome when it comes to borrow checking.
This is an excert of my method which parses a node and, in case it's not a nameof
expression, returns None
and otherwise returns an Err
(possibly holding immutable parts of the node) or an Ok
(holding mutable parts of the node):
Sadly, I can't find myself able to find a way to work around the error reported in this code snippet.
Could you help me understand what I'm doing wrong or how I can improve this piece of code?
Best regards
6 posts - 4 participants
🏷️ rust_feed