Trait juniper::FromContext

source ·
pub trait FromContext<T> {
    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

Perform the conversion

Implementations on Foreign Types

Implementors