pub struct Symbol(NonZero<u32>);
🔬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: NonZero<u32>
🔬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)Creates 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)Checks 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§
impl Copy for Symbol
impl !Send for Symbol
impl StructuralPartialEq for Symbol
impl !Sync for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
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<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more