[−][src]Struct sonyflake::Builder
A builder to build a Sonyflake
generator.
Implementations
impl<'a> Builder<'a>
[src]
pub fn new() -> Self
[src]
Construct a new builder to call methods on for the Sonyflake
construction.
pub fn start_time(self, start_time: DateTime<Utc>) -> Self
[src]
Sets the start time. If the time is ahead of current time, finalize will fail.
pub fn machine_id(
self,
machine_id: &'a dyn Fn() -> Result<u16, Box<dyn Error + Send + Sync + 'static>>
) -> Self
[src]
self,
machine_id: &'a dyn Fn() -> Result<u16, Box<dyn Error + Send + Sync + 'static>>
) -> Self
Sets the machine id. If the fn returns an error, finalize will fail.
pub fn check_machine_id(self, check_machine_id: &'a dyn Fn(u16) -> bool) -> Self
[src]
Set a function to check the machine id. If the fn returns false, finalize will fail.
pub fn finalize(self) -> Result<Sonyflake, Error>
[src]
Finalize the builder to create a Sonyflake.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Builder<'a>
[src]
impl<'a> !Send for Builder<'a>
[src]
impl<'a> !Sync for Builder<'a>
[src]
impl<'a> Unpin for Builder<'a>
[src]
impl<'a> !UnwindSafe for Builder<'a>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,