pub struct UniqueNames<'a> { /* private fields */ }Expand description
A scope that claims target language names before final case rendering.
UniqueNames canonicalizes source name parts into word segments,
assigns collision suffixes for already-claimed names, and returns
opaque UniqueName handles for codegen to render in any case style.
Implementations§
Source§impl<'a> UniqueNames<'a>
impl<'a> UniqueNames<'a>
Sourcepub fn with_reserved<'part, R>(arena: &'a Arena, reserved: R) -> Self
pub fn with_reserved<'part, R>(arena: &'a Arena, reserved: R) -> Self
Creates a name scope that reserves existing names.
Sourcepub fn claim<'part>(
&mut self,
parts: impl IntoIterator<Item = NamePart<'part>>,
) -> UniqueName<'a>
pub fn claim<'part>( &mut self, parts: impl IntoIterator<Item = NamePart<'part>>, ) -> UniqueName<'a>
Claims a segmented source name, and returns a name that’s unique within this scope.
If the name has already been claimed, the returned name receives the next free unique numeric suffix.
Sourcepub fn adopt(&mut self, name: UniqueName<'a>) -> UniqueName<'a>
pub fn adopt(&mut self, name: UniqueName<'a>) -> UniqueName<'a>
Claims a name that’s already unique in another scope, and returns a unique form of that name in this scope.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for UniqueNames<'a>
impl<'a> !Send for UniqueNames<'a>
impl<'a> !Sync for UniqueNames<'a>
impl<'a> !UnwindSafe for UniqueNames<'a>
impl<'a> Freeze for UniqueNames<'a>
impl<'a> Unpin for UniqueNames<'a>
impl<'a> UnsafeUnpin for UniqueNames<'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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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