pub struct SyntaxContext(/* private fields */);Expand description
A SyntaxContext represents a chain of macro expansions (represented by marks).
Implementations§
Source§impl SyntaxContext
impl SyntaxContext
Sourcepub fn within_ignored_ctxt<F, Ret>(op: F) -> Retwhere
F: FnOnce() -> Ret,
pub fn within_ignored_ctxt<F, Ret>(op: F) -> Retwhere
F: FnOnce() -> Ret,
In op, EqIgnoreSpan of [Ident] will ignore the syntax context.
Source§impl SyntaxContext
impl SyntaxContext
pub const fn empty() -> SyntaxContext
Sourcepub fn has_mark(self, mark: Mark) -> bool
pub fn has_mark(self, mark: Mark) -> bool
Returns true if self is marked with mark.
Panics if mark is not a valid mark.
pub fn as_u32(self) -> u32
pub fn from_u32(raw: u32) -> SyntaxContext
Sourcepub fn apply_mark(self, mark: Mark) -> SyntaxContext
pub fn apply_mark(self, mark: Mark) -> SyntaxContext
Extend a syntax context with a given mark and default transparency for that mark.
Sourcepub fn remove_mark(&mut self) -> Mark
pub fn remove_mark(&mut self) -> Mark
Pulls a single mark off of the syntax context. This effectively moves the context up one macro definition level. That is, if we have a nested macro definition as follows:
macro_rules! f {
macro_rules! g {
...
}
}and we have a SyntaxContext that is referring to something declared by an invocation of g (call it g1), calling remove_mark will result in the SyntaxContext for the invocation of f that created g1. Returns the mark that was removed.
pub fn outer(self) -> Mark
Trait Implementations§
Source§impl Clone for SyntaxContext
impl Clone for SyntaxContext
Source§fn clone(&self) -> SyntaxContext
fn clone(&self) -> SyntaxContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyntaxContext
impl Debug for SyntaxContext
Source§impl Default for SyntaxContext
impl Default for SyntaxContext
Source§fn default() -> SyntaxContext
fn default() -> SyntaxContext
Source§impl<'de> Deserialize<'de> for SyntaxContext
impl<'de> Deserialize<'de> for SyntaxContext
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<SyntaxContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<SyntaxContext, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl EqIgnoreSpan for SyntaxContext
impl EqIgnoreSpan for SyntaxContext
fn eq_ignore_span(&self, other: &SyntaxContext) -> bool
Source§impl<V> FoldWith<V> for SyntaxContext
impl<V> FoldWith<V> for SyntaxContext
Source§fn fold_with(self, visitor: &mut V) -> SyntaxContext
fn fold_with(self, visitor: &mut V) -> SyntaxContext
Calls Fold::fold_syntax_context with self. (Extra impl)
Source§fn fold_children_with(self, visitor: &mut V) -> SyntaxContext
fn fold_children_with(self, visitor: &mut V) -> SyntaxContext
self`` with visitor`.Source§impl Hash for SyntaxContext
impl Hash for SyntaxContext
Source§impl Ord for SyntaxContext
impl Ord for SyntaxContext
Source§fn cmp(&self, other: &SyntaxContext) -> Ordering
fn cmp(&self, other: &SyntaxContext) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SyntaxContext
impl PartialEq for SyntaxContext
Source§impl PartialOrd for SyntaxContext
impl PartialOrd for SyntaxContext
Source§impl Serialize for SyntaxContext
impl Serialize for SyntaxContext
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<V> VisitMutWith<V> for SyntaxContext
impl<V> VisitMutWith<V> for SyntaxContext
Source§fn visit_mut_with(&mut self, visitor: &mut V)
fn visit_mut_with(&mut self, visitor: &mut V)
Calls VisitMut::visit_mut_syntax_context with self. (Extra impl)
Source§fn visit_mut_children_with(&mut self, visitor: &mut V)
fn visit_mut_children_with(&mut self, visitor: &mut V)
self`` with visitor`.Source§impl<V> VisitWith<V> for SyntaxContext
impl<V> VisitWith<V> for SyntaxContext
Source§fn visit_with(&self, visitor: &mut V)
fn visit_with(&self, visitor: &mut V)
Calls Visit::visit_syntax_context with self. (Extra impl)
Source§fn visit_children_with(&self, visitor: &mut V)
fn visit_children_with(&self, visitor: &mut V)
self`` with visitor`.impl Copy for SyntaxContext
impl Eq for SyntaxContext
impl StructuralPartialEq for SyntaxContext
Auto Trait Implementations§
impl Freeze for SyntaxContext
impl RefUnwindSafe for SyntaxContext
impl Send for SyntaxContext
impl Sync for SyntaxContext
impl Unpin for SyntaxContext
impl UnsafeUnpin for SyntaxContext
impl UnwindSafe for SyntaxContext
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
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<T> ImplicitClone for Twhere
T: Clone,
impl<T> ImplicitClone for Twhere
T: Clone,
fn clone_quote_var(&self) -> Self
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> ⓘ
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> ⓘ
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