pub struct UniqueIdents<'a>(/* private fields */);Expand description
A scope for generating unique, valid Rust identifiers.
Implementations§
Source§impl<'a> UniqueIdents<'a>
impl<'a> UniqueIdents<'a>
Sourcepub fn new(arena: &'a Arena) -> Self
pub fn new(arena: &'a Arena) -> Self
Creates a new identifier scope that’s backed by the given arena.
Sourcepub fn with_reserved(arena: &'a Arena, reserved: &[&str]) -> Self
pub fn with_reserved(arena: &'a Arena, reserved: &[&str]) -> Self
Creates a new identifier scope that’s backed by the given arena, with additional pre-reserved names.
Sourcepub fn ident(&mut self, name: &str) -> &'a UniqueIdent
pub fn ident(&mut self, name: &str) -> &'a UniqueIdent
Cleans and uniquifies an identifier.
Sourcepub fn field_name_hint(&mut self, hint: StructFieldNameHint) -> &'a UniqueIdent
pub fn field_name_hint(&mut self, hint: StructFieldNameHint) -> &'a UniqueIdent
Uniquifies a struct field name from a StructFieldNameHint.
Sourcepub fn variant_name_hint(
&mut self,
hint: UntaggedVariantNameHint,
) -> &'a UniqueIdent
pub fn variant_name_hint( &mut self, hint: UntaggedVariantNameHint, ) -> &'a UniqueIdent
Uniquifies an untagged union variant name from an
UntaggedVariantNameHint.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for UniqueIdents<'a>
impl<'a> !RefUnwindSafe for UniqueIdents<'a>
impl<'a> !Send for UniqueIdents<'a>
impl<'a> !Sync for UniqueIdents<'a>
impl<'a> Unpin for UniqueIdents<'a>
impl<'a> UnsafeUnpin for UniqueIdents<'a>
impl<'a> !UnwindSafe for UniqueIdents<'a>
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> 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>
Converts
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>
Converts
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