Type Alias MacroRulesScopeRef

Source
pub(crate) type MacroRulesScopeRef<'ra> = Interned<'ra, Cell<MacroRulesScope<'ra>>>;
Expand description

macro_rules! scopes are always kept by reference and inside a cell. The reason is that we update scopes with value MacroRulesScope::Invocation(invoc_id) in-place after invoc_id gets expanded. This helps to avoid uncontrollable growth of macro_rules! scope chains, which usually grow linearly with the number of macro invocations in a module (including derives) and hurt performance.

Aliased Type§

struct MacroRulesScopeRef<'ra>(pub &'ra Cell<MacroRulesScope<'ra>>, pub PrivateZst);

Fields§

§0: &'ra Cell<MacroRulesScope<'ra>>§1: PrivateZst

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: 8 bytes

Implementations

Source§

impl<'a, T> Interned<'a, T>

Source

pub const fn new_unchecked(t: &'a T) -> Interned<'a, T>

Create a new Interned value. The value referred to must be interned and thus be unique, and it must remain unique in the future. This function has _unchecked in the name but is not unsafe, because if the uniqueness condition is violated condition it will cause incorrect behaviour but will not affect memory safety.

Trait Implementations

Source§

impl<'a, T> Clone for Interned<'a, T>

Source§

fn clone(&self) -> Interned<'a, T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for Interned<'_, T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, T> Deref for Interned<'a, T>

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'a, T> Hash for Interned<'a, T>
where T: Hash,

Source§

fn hash<H>(&self, s: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, CTX> HashStable<CTX> for Interned<'_, T>
where T: HashStable<CTX>,

Source§

fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher<SipHasher128>)

Source§

impl<'a, T> Ord for Interned<'a, T>
where T: Ord,

Source§

fn cmp(&self, other: &Interned<'a, T>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'a, T> PartialEq for Interned<'a, T>

Source§

fn eq(&self, other: &Interned<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T> PartialOrd for Interned<'a, T>
where T: PartialOrd,

Source§

fn partial_cmp(&self, other: &Interned<'a, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, T> Copy for Interned<'a, T>

Source§

impl<'a, T> DynSync for Interned<'a, T>
where T: DynSync,

Source§

impl<'a, T> Eq for Interned<'a, T>