pub struct Anchor {
pub expansion: SourceRange,
pub definition: Option<SourceRange>,
}Expand description
Where a node is, and where it was written.
Fields§
§expansion: SourceRangeWhere the code sits in the file being read. Syntax fragments are cut from here, so this is what a node anchors to.
definition: Option<SourceRange>Where the code was written, when that is somewhere else — inside a macro body, or in the template this instantiation came from.
None for code that is where it was written.
Implementations§
Source§impl Anchor
impl Anchor
Sourcepub const fn written_here(range: SourceRange) -> Self
pub const fn written_here(range: SourceRange) -> Self
An anchor for code that is where it was written.
Sourcepub const fn is_expanded(&self) -> bool
pub const fn is_expanded(&self) -> bool
Whether this node was produced somewhere other than where it reads.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Anchor
impl<'de> Deserialize<'de> for Anchor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Anchor
impl StructuralPartialEq for Anchor
Auto Trait Implementations§
impl Freeze for Anchor
impl RefUnwindSafe for Anchor
impl Send for Anchor
impl Sync for Anchor
impl Unpin for Anchor
impl UnsafeUnpin for Anchor
impl UnwindSafe for Anchor
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