pub trait SnowflakeGeneratorAsyncExt<ID, T>{
// Required method
fn try_next_id_async<S>(&self) -> impl Future<Output = Result<ID>>
where S: SleepProvider;
}Expand description
Extension trait for asynchronously generating Snowflake IDs.
This trait enables SnowflakeGenerator types to yield IDs in a
Future-based context by awaiting until the generator is ready to produce a
new ID.
The default implementation uses GeneratorFuture and a specified
SleepProvider to yield when the generator is not yet ready.
Required Methods§
Sourcefn try_next_id_async<S>(&self) -> impl Future<Output = Result<ID>>where
S: SleepProvider,
fn try_next_id_async<S>(&self) -> impl Future<Output = Result<ID>>where
S: SleepProvider,
Returns a future that resolves to the next available Snowflake ID.
If the generator is not ready to issue a new ID immediately, the future will sleep for the amount of time indicated by the generator and retry.
§Errors
This future may return an error if the generator encounters one.
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.