Trait SnowflakeGeneratorAsyncTokioExt

Source
pub trait SnowflakeGeneratorAsyncTokioExt<ID, T>
where ID: Snowflake, T: TimeSource<ID::Ty>,
{ // Required method fn try_next_id_async(&self) -> impl Future<Output = Result<ID>>; }
Expand description

Extension trait for asynchronously generating Snowflake IDs 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 Methods§

Source

fn try_next_id_async(&self) -> impl Future<Output = Result<ID>>

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

Internally delegates to SnowflakeGeneratorAsyncExt::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> SnowflakeGeneratorAsyncTokioExt<ID, T> for G
where G: SnowflakeGenerator<ID, T>, ID: Snowflake, T: TimeSource<ID::Ty>,