Skip to main content

FromContext

Trait FromContext 

Source
pub trait FromContext<Input>: Send {
    // Required method
    fn from(ctx: Context<Input>) -> impl Future<Output = Self> + Send;
}
Expand description

A trait for types that can be extracted from a Context. Similar to Axum’s FromRequest or Bevy’s SystemParam.

Required Methods§

Source

fn from(ctx: Context<Input>) -> impl Future<Output = Self> + Send

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<I, T> FromContext<I> for Res<T>
where I: Send + Sync + 'static, T: Send + Sync + 'static,

Source§

impl<I, T> FromContext<I> for ResMut<T>
where I: Send + Sync + 'static, T: Send + Sync + 'static,

Source§

impl<I: Send + Sync + 'static> FromContext<I> for Input<I>