pub struct IdGeneratorBuilder { /* private fields */ }Expand description
Builder for IdGenerator.
Implementations§
Source§impl IdGeneratorBuilder
impl IdGeneratorBuilder
Sourcepub fn prefix(self, prefix: impl Into<String>) -> Self
pub fn prefix(self, prefix: impl Into<String>) -> Self
Set the prefix. Must be 1–16 characters of A-Z or 0-9.
Sourcepub fn entropy_bits(self, bits: u16) -> Self
pub fn entropy_bits(self, bits: u16) -> Self
Set the entropy width in bits. Must be a multiple of 4 (one hex character) between 16 and 512.
Sourcepub fn build(self) -> Result<IdGenerator>
pub fn build(self) -> Result<IdGenerator>
Validate the settings and build the generator.
§Errors
Returns Error::InvalidIdConfig if the prefix or entropy width is
out of range.
Trait Implementations§
Source§impl Clone for IdGeneratorBuilder
impl Clone for IdGeneratorBuilder
Source§fn clone(&self) -> IdGeneratorBuilder
fn clone(&self) -> IdGeneratorBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IdGeneratorBuilder
impl Debug for IdGeneratorBuilder
Auto Trait Implementations§
impl Freeze for IdGeneratorBuilder
impl RefUnwindSafe for IdGeneratorBuilder
impl Send for IdGeneratorBuilder
impl Sync for IdGeneratorBuilder
impl Unpin for IdGeneratorBuilder
impl UnsafeUnpin for IdGeneratorBuilder
impl UnwindSafe for IdGeneratorBuilder
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