pub struct Builder<'a> { /* private fields */ }Expand description
A builder to build a Sonyflake generator.
Implementations§
Source§impl<'a> Builder<'a>
impl<'a> Builder<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new builder to call methods on for the Sonyflake construction.
Sourcepub fn start_time(self, start_time: DateTime<Utc>) -> Self
pub fn start_time(self, start_time: DateTime<Utc>) -> Self
Sets the start time. If the time is ahead of current time, finalize will fail.
Sourcepub fn machine_id(
self,
machine_id: &'a dyn Fn() -> Result<u16, Box<dyn StdError + Send + Sync + 'static>>,
) -> Self
pub fn machine_id( self, machine_id: &'a dyn Fn() -> Result<u16, Box<dyn StdError + Send + Sync + 'static>>, ) -> Self
Sets the machine id. If the fn returns an error, finalize will fail.
Sourcepub fn check_machine_id(self, check_machine_id: &'a dyn Fn(u16) -> bool) -> Self
pub fn check_machine_id(self, check_machine_id: &'a dyn Fn(u16) -> bool) -> Self
Set a function to check the machine id. If the fn returns false, finalize will fail.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Builder<'a>
impl<'a> !RefUnwindSafe for Builder<'a>
impl<'a> !Send for Builder<'a>
impl<'a> !Sync for Builder<'a>
impl<'a> Unpin for Builder<'a>
impl<'a> !UnwindSafe for Builder<'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