pub enum Origin {
Source,
Expanded {
invocations: Vec<MacroInvocation>,
},
Pasted {
call_site: SourceRange,
},
Stringized {
call_site: SourceRange,
},
}Expand description
Where a token in an expanded stream came from.
Variants§
Source
The file — the token is exactly what the user typed.
Expanded
A macro body, and the chain of calls that got here.
A chain, not one call, because an expansion can be nested: #define A 1 / #define B A used as
B produces a 1 that was written in A’s body, reached through B’s. Which of the two a
consumer wants depends on what it is doing — see ExpandedToken::diagnostic_range and
ExpandedToken::navigation_at — so both are here rather than one being chosen here.
Outermost first, so that “the first call the reader can see” is a scan from the front.
Fields
§
invocations: Vec<MacroInvocation>Pasted
Two tokens joined by ##.
Fields
§
call_site: SourceRangeStringized
A string literal produced by #.
Fields
§
call_site: SourceRangeTrait Implementations§
impl Eq for Origin
impl StructuralPartialEq for Origin
Auto Trait Implementations§
impl Forget for Origin
impl Freeze for Origin
impl RefUnwindSafe for Origin
impl Send for Origin
impl Sync for Origin
impl Unpin for Origin
impl UnsafeUnpin for Origin
impl UnwindSafe for Origin
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more