pub trait FromContext<T> {
    // Required method
    fn from(value: &T) -> &Self;
}
Expand description

Conversion trait for context types

Used to support different context types for different parts of an application. By making each GraphQL type only aware of as much context as it needs to, isolation and robustness can be improved. Implement this trait if you have contexts that can generally be converted between each other.

The empty tuple () can be converted into from any context type, making it suitable for GraphQL that don’t need any context to work, e.g. scalars or enums.

Required Methods§

source

fn from(value: &T) -> &Self

Perform the conversion

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> FromContext<T> for ()

Implementors§

source§

impl<T> FromContext<T> for T
where T: Context,