Struct proc_macro::bridge::symbol::Symbol
source · pub struct Symbol(NonZeroU32);
🔬This is a nightly-only experimental API. (
proc_macro_internals
#27812)Expand description
Handle for a symbol string stored within the Interner.
Tuple Fields§
§0: NonZeroU32
🔬This is a nightly-only experimental API. (
proc_macro_internals
#27812)Implementations§
source§impl Symbol
impl Symbol
sourcepub(crate) fn new(string: &str) -> Self
🔬This is a nightly-only experimental API. (proc_macro_internals
#27812)
pub(crate) fn new(string: &str) -> Self
proc_macro_internals
#27812)Intern a new Symbol
sourcepub(crate) fn new_ident(string: &str, is_raw: bool) -> Self
🔬This is a nightly-only experimental API. (proc_macro_internals
#27812)
pub(crate) fn new_ident(string: &str, is_raw: bool) -> Self
proc_macro_internals
#27812)Create a new Symbol
for an identifier.
Validates and normalizes before converting it to a symbol.
sourcepub(crate) fn with<R>(self, f: impl FnOnce(&str) -> R) -> R
🔬This is a nightly-only experimental API. (proc_macro_internals
#27812)
pub(crate) fn with<R>(self, f: impl FnOnce(&str) -> R) -> R
proc_macro_internals
#27812)Run a callback with the symbol’s string value.
sourcepub(crate) fn invalidate_all()
🔬This is a nightly-only experimental API. (proc_macro_internals
#27812)
pub(crate) fn invalidate_all()
proc_macro_internals
#27812)Clear out the thread-local symbol interner, making all previously
created symbols invalid such that with
will panic when called on them.
sourcefn is_valid_ascii_ident(bytes: &[u8]) -> bool
🔬This is a nightly-only experimental API. (proc_macro_internals
#27812)
fn is_valid_ascii_ident(bytes: &[u8]) -> bool
proc_macro_internals
#27812)Check if the ident is a valid ASCII identifier.
This is a short-circuit which is cheap to implement within the
proc-macro client to avoid RPC when creating simple idents, but may
return false
for a valid identifier if it contains non-ASCII
characters.
fn can_be_raw(string: &str) -> bool
🔬This is a nightly-only experimental API. (
proc_macro_internals
#27812)Trait Implementations§
source§impl PartialEq<Symbol> for Symbol
impl PartialEq<Symbol> for Symbol
impl Copy for Symbol
impl !Send for Symbol
impl StructuralEq for Symbol
impl StructuralPartialEq for Symbol
impl !Sync for Symbol
Auto Trait Implementations§
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