axum_core::extract

Trait FromRef

Source
pub trait FromRef<T> {
    // Required method
    fn from_ref(input: &T) -> Self;
}
Expand description

Used to do reference-to-value conversions thus not consuming the input value.

This is mainly used with State to extract “substates” from a reference to main application state.

See State for more details on how library authors should use this trait.

This trait can be derived using #[derive(FromRef)].

Required Methods§

Source

fn from_ref(input: &T) -> Self

Converts to this type from a reference to the input type.

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<T> FromRef<T> for T
where T: Clone,