UlidGeneratorAsyncTokioExt

Trait UlidGeneratorAsyncTokioExt 

Source
pub trait UlidGeneratorAsyncTokioExt<ID, T, R>
where ID: UlidId, T: TimeSource<ID::Ty>, R: RandSource<ID::Ty>,
{ type Err; // Required method fn try_next_id_async(&self) -> impl Future<Output = Result<ID, Self::Err>>; }
Available on crate features async-tokio and ulid only.
Expand description

Extension trait for asynchronously generating ULIDs using the tokio async runtime.

This trait provides a convenience method for using a SleepProvider backed by the tokio runtime, allowing you to call .try_next_id_async() without specifying the sleep strategy manually.

Required Associated Types§

Required Methods§

Source

fn try_next_id_async(&self) -> impl Future<Output = Result<ID, Self::Err>>

Returns a future that resolves to the next available ULID using the TokioSleep provider.

Internally delegates to UlidGeneratorAsyncExt::try_next_id_async method with TokioSleep as the sleep strategy.

§Errors

This future may return an error if the underlying generator does.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<G, ID, T, R> UlidGeneratorAsyncTokioExt<ID, T, R> for G
where G: UlidGenerator<ID, T, R>, ID: UlidId, T: TimeSource<ID::Ty>, R: RandSource<ID::Ty>,

Available on crate features async-tokio or async-smol only.
Source§

type Err = <G as UlidGenerator<ID, T, R>>::Err