[][src]Trait juniper::FromContext

pub trait FromContext<T> {
    fn from(value: &T) -> &Self;
}

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

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

Perform the conversion

Loading content...

Implementations on Foreign Types

impl<T> FromContext<T> for ()[src]

Loading content...

Implementors

impl<T> FromContext<T> for T where
    T: Context
[src]

Loading content...