SnowflakeGeneratorAsyncTokioExt

Trait SnowflakeGeneratorAsyncTokioExt 

Source
pub trait SnowflakeGeneratorAsyncTokioExt<ID, T>
where ID: SnowflakeId, T: TimeSource<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 snowflake only.
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 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 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: SnowflakeId, T: TimeSource<ID::Ty>,

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

type Err = <G as SnowflakeGenerator<ID, T>>::Err