#[non_exhaustive]pub enum ParentRef {
Struct(SyntaxNode),
Map(SyntaxNode),
List(SyntaxNode),
Tuple(SyntaxNode),
EnumVariant(SyntaxNode),
}Expand description
Which collection a structural op targets, addressed by an ast-navigable
reference (parent kind + index into the document).
A ParentRef names one collection node in the document being
transformed. The caller resolves a selection to a parent + index; this module
re-resolves the parent (by walking the document’s value tree to the node whose
byte range matches) and then addresses elements by index within it.
#[non_exhaustive] so future container kinds can be added without a breaking
change.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Struct(SyntaxNode)
A struct / anonymous struct node (its field: value entries).
Map(SyntaxNode)
A map node (its key: value entries).
List(SyntaxNode)
A list node (its elements).
Tuple(SyntaxNode)
A tuple node (its positional elements).
EnumVariant(SyntaxNode)
An enum variant’s struct-like payload (its field: value entries).
Implementations§
Source§impl ParentRef
impl ParentRef
Sourcepub fn node(&self) -> &SyntaxNode
pub fn node(&self) -> &SyntaxNode
The underlying parent SyntaxNode.
Trait Implementations§
impl Eq for ParentRef
impl StructuralPartialEq for ParentRef
Auto Trait Implementations§
impl !RefUnwindSafe for ParentRef
impl !Send for ParentRef
impl !Sync for ParentRef
impl !UnwindSafe for ParentRef
impl Freeze for ParentRef
impl Unpin for ParentRef
impl UnsafeUnpin for ParentRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more