#[non_exhaustive]pub struct PirSourceAnchor {
pub kind: PirAnchorKind,
pub range: Option<SourceLocation>,
pub anchor_id: Option<AnchorId>,
pub hir_item: Option<HirId>,
}Expand description
Source anchor for a PIR node.
A source anchor records why a node exists and where it came from. Nodes
without a concrete range (generated-no-source, ambient, unknown) keep
range and anchor_id absent and explain themselves through kind.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: PirAnchorKindProvenance class for this anchor.
range: Option<SourceLocation>Workspace source range that caused the node, when source-backed.
anchor_id: Option<AnchorId>Stable anchor id derived from the source range, when source-backed.
hir_item: Option<HirId>HIR item this node lowered from, when available.
Implementations§
Source§impl PirSourceAnchor
impl PirSourceAnchor
Sourcepub fn explicit(range: SourceLocation, hir_item: HirId) -> Self
pub fn explicit(range: SourceLocation, hir_item: HirId) -> Self
Build a source-backed anchor from a HIR item and its range.
Sourcepub fn dynamic_boundary(range: SourceLocation, hir_item: HirId) -> Self
pub fn dynamic_boundary(range: SourceLocation, hir_item: HirId) -> Self
Build a dynamic-boundary anchor pointing at the boundary range.
Sourcepub fn is_anchored(&self) -> bool
pub fn is_anchored(&self) -> bool
Return true when this anchor preserves a concrete source range.
Trait Implementations§
Source§impl Clone for PirSourceAnchor
impl Clone for PirSourceAnchor
Source§fn clone(&self) -> PirSourceAnchor
fn clone(&self) -> PirSourceAnchor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PirSourceAnchor
impl Debug for PirSourceAnchor
impl Eq for PirSourceAnchor
Source§impl PartialEq for PirSourceAnchor
impl PartialEq for PirSourceAnchor
Source§fn eq(&self, other: &PirSourceAnchor) -> bool
fn eq(&self, other: &PirSourceAnchor) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PirSourceAnchor
Auto Trait Implementations§
impl Freeze for PirSourceAnchor
impl RefUnwindSafe for PirSourceAnchor
impl Send for PirSourceAnchor
impl Sync for PirSourceAnchor
impl Unpin for PirSourceAnchor
impl UnsafeUnpin for PirSourceAnchor
impl UnwindSafe for PirSourceAnchor
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