pub struct UniqueNameGenerator {
pub existing_names: HashSet<String>,
/* private fields */
}
Expand description
Generates names that are based on a prefix and avoids collisions with names already taken.
Fields§
§existing_names: HashSet<String>
Names that are already taken i.e. would never be generated again.
Implementations§
Source§impl UniqueNameGenerator
impl UniqueNameGenerator
Sourcepub fn is_name_conflicting<T: ToString>(&self, name: T) -> bool
pub fn is_name_conflicting<T: ToString>(&self, name: T) -> bool
Returns true
only if name
is present in
UniqueNameGenerator::existing_names
.
Sourcepub fn add_names<I: ToString, T: IntoIterator<Item = I>>(&mut self, names: T)
pub fn add_names<I: ToString, T: IntoIterator<Item = I>>(&mut self, names: T)
Calls UniqueNameGenerator::add_name
on each name in names
.
Auto Trait Implementations§
impl Freeze for UniqueNameGenerator
impl RefUnwindSafe for UniqueNameGenerator
impl Send for UniqueNameGenerator
impl Sync for UniqueNameGenerator
impl Unpin for UniqueNameGenerator
impl UnwindSafe for UniqueNameGenerator
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