pub struct SyntaxContext(_);
A SyntaxContext represents a chain of macro expansions (represented by marks).
Extend a syntax context with a given mark and default transparency for that mark.
Extend a syntax context with a given mark and transparency
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.
Adjust this context for resolution in a scope created by the given expansion.
For example, consider the following three resolutions of f
:
mod foo { pub fn f() {} }
m!(f);
macro m($f:ident) {
mod bar {
pub fn f() {}
pub fn $f() {}
}
foo::f();
bar::f();
bar::$f();
}
This returns the expansion whose definition scope we use to privacy check the resolution,
or None
if we privacy check as usual (i.e., not w.r.t. a macro definition scope).
Adjust this context for resolution in a scope created by the given expansion
via a glob import with the given SyntaxContext
.
For example:
m!(f);
macro m($i:ident) {
mod foo {
pub fn f() {}
pub fn $i() {}
}
n(f);
macro n($j:ident) {
use foo::*;
f();
$i();
$j();
}
}
This returns None
if the context cannot be glob-adjusted.
Otherwise, it returns the scope to use when privacy checking (see adjust
for details).
Undo glob_adjust
if possible:
if let Some(privacy_checking_scope) = self.reverse_glob_adjust(expansion, glob_ctxt) {
assert!(self.glob_adjust(expansion, glob_ctxt) == Some(privacy_checking_scope));
}
Returns the "default value" for a type. Read more
Performs copy-assignment from source
. Read more
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self | 1.21.0 [src] |
Compares and returns the minimum of two values. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more