pub struct AnyIdAllocator(/* private fields */);Expand description
A shared IdAllocator.
Clones lease from the same allocator. The default is a WordAllocator
over its built-in word list.
Implementations§
Source§impl AnyIdAllocator
impl AnyIdAllocator
Sourcepub fn new(allocator: impl IdAllocator) -> Self
pub fn new(allocator: impl IdAllocator) -> Self
Shares allocator.
Sourcepub fn lease(&self) -> Result<IdLease, IdsExhausted>
pub fn lease(&self) -> Result<IdLease, IdsExhausted>
Leases a word that no live lease holds; it is released when the last clone of the returned lease drops.
§Errors
Returns IdsExhausted when every word is leased.
§Panics
Panics when the allocator hands out a word that is not one or more lowercase ASCII letters.
Trait Implementations§
Source§impl Clone for AnyIdAllocator
impl Clone for AnyIdAllocator
Source§impl Debug for AnyIdAllocator
impl Debug for AnyIdAllocator
Auto Trait Implementations§
impl !RefUnwindSafe for AnyIdAllocator
impl !UnwindSafe for AnyIdAllocator
impl Forget for AnyIdAllocator
impl Freeze for AnyIdAllocator
impl Send for AnyIdAllocator
impl Sync for AnyIdAllocator
impl Unpin for AnyIdAllocator
impl UnsafeUnpin for AnyIdAllocator
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