[][src]Struct sonyflake::Builder

pub struct Builder<'a> { /* fields omitted */ }

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]

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

impl<'a> Default for Builder<'a>[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.