Struct rustc_span::hygiene::LocalExpnId
source · pub struct LocalExpnId {
private: u32,
}
Expand description
A unique ID associated with a macro invocation and expansion.
Fields§
§private: u32
Implementations§
source§impl LocalExpnId
impl LocalExpnId
sourcepub const MAX_AS_U32: u32 = 4_294_967_040u32
pub const MAX_AS_U32: u32 = 4_294_967_040u32
Maximum value the index can take, as a u32
.
sourcepub const fn from_usize(value: usize) -> Self
pub const fn from_usize(value: usize) -> Self
sourcepub const unsafe fn from_u32_unchecked(value: u32) -> Self
pub const unsafe fn from_u32_unchecked(value: u32) -> Self
Creates a new index from a given u32
.
Safety
The provided value must be less than or equal to the maximum value for the newtype. Providing a value outside this range is undefined due to layout restrictions.
Prefer using from_u32
.
source§impl LocalExpnId
impl LocalExpnId
sourcepub const ROOT: LocalExpnId = _
pub const ROOT: LocalExpnId = _
The ID of the theoretical expansion that generates freshly parsed, unexpanded AST.
pub fn from_raw(idx: ExpnIndex) -> LocalExpnId
pub fn as_raw(self) -> ExpnIndex
pub fn fresh_empty() -> LocalExpnId
pub fn fresh(expn_data: ExpnData, ctx: impl HashStableContext) -> LocalExpnId
pub fn expn_hash(self) -> ExpnHash
pub fn expn_data(self) -> ExpnData
pub fn to_expn_id(self) -> ExpnId
pub fn set_expn_data(self, expn_data: ExpnData, ctx: impl HashStableContext)
pub fn is_descendant_of(self, ancestor: LocalExpnId) -> bool
sourcepub fn outer_expn_is_descendant_of(self, ctxt: SyntaxContext) -> bool
pub fn outer_expn_is_descendant_of(self, ctxt: SyntaxContext) -> bool
expn_id.outer_expn_is_descendant_of(ctxt)
is equivalent to but faster than
expn_id.is_descendant_of(ctxt.outer_expn())
.
sourcepub fn expansion_cause(self) -> Option<Span>
pub fn expansion_cause(self) -> Option<Span>
Returns span for the macro which originally caused this expansion to happen.
Stops backtracing at include! boundary.
pub fn parent(self) -> LocalExpnId
Trait Implementations§
source§impl Add<usize> for LocalExpnId
impl Add<usize> for LocalExpnId
source§impl Clone for LocalExpnId
impl Clone for LocalExpnId
source§fn clone(&self) -> LocalExpnId
fn clone(&self) -> LocalExpnId
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for LocalExpnId
impl Debug for LocalExpnId
source§impl From<LocalExpnId> for u32
impl From<LocalExpnId> for u32
source§fn from(v: LocalExpnId) -> u32
fn from(v: LocalExpnId) -> u32
source§impl From<LocalExpnId> for usize
impl From<LocalExpnId> for usize
source§fn from(v: LocalExpnId) -> usize
fn from(v: LocalExpnId) -> usize
source§impl From<u32> for LocalExpnId
impl From<u32> for LocalExpnId
source§impl From<usize> for LocalExpnId
impl From<usize> for LocalExpnId
source§impl Hash for LocalExpnId
impl Hash for LocalExpnId
source§impl Idx for LocalExpnId
impl Idx for LocalExpnId
source§impl !Ord for LocalExpnId
impl !Ord for LocalExpnId
source§impl PartialEq<LocalExpnId> for LocalExpnId
impl PartialEq<LocalExpnId> for LocalExpnId
source§fn eq(&self, other: &LocalExpnId) -> bool
fn eq(&self, other: &LocalExpnId) -> bool
source§impl !PartialOrd<LocalExpnId> for LocalExpnId
impl !PartialOrd<LocalExpnId> for LocalExpnId
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for LocalExpnId
impl Eq for LocalExpnId
impl StructuralEq for LocalExpnId
impl StructuralPartialEq for LocalExpnId
Auto Trait Implementations§
impl RefUnwindSafe for LocalExpnId
impl Send for LocalExpnId
impl Sync for LocalExpnId
impl Unpin for LocalExpnId
impl UnwindSafe for LocalExpnId
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 4 bytes