pub trait RequestContext: 'static + Clone + Debug + Send + Sync {
    type DBEndpointType: DatabaseEndpoint;

    fn new() -> Self;
}
Expand description

Trait that, when implemented, marks a struct as a request context, used to pass data to custom extensions and resolvers on a per-request basis

Examples


#[derive(Clone, Debug)]
struct AppRequestContext {
    session_token: String
}

impl RequestContext for AppRequestContext {
    type DBEndpointType = NoDatabaseEndpoint;
    fn new() -> Self {
        AppRequestContext { session_token: "".to_string() }
    }
}

let ac = AppRequestContext { session_token: "".to_string() };

Required Associated Types

Required Methods

Implementations on Foreign Types

Implementors