Struct juniper_graphql_ws::Connection[][src]

pub struct Connection<S: Schema, I: Init<S::ScalarValue, S::Context>> { /* fields omitted */ }

Implements the graphql-ws protocol. This is a sink for TryInto<ClientMessage> and a stream of ServerMessage.

Implementations

impl<S, I> Connection<S, I> where
    S: Schema,
    I: Init<S::ScalarValue, S::Context>, 
[src]

pub fn new(schema: S, init: I) -> Self[src]

Creates a new connection, which is a sink for TryInto<ClientMessage> and a stream of ServerMessage.

The schema argument should typically be an Arc<RootNode<...>>.

The init argument is used to provide the context and additional configuration for connections. This can be a ConnectionConfig if the context and configuration are already known, or it can be a closure that gets executed asynchronously when the client sends the ConnectionInit message. Using a closure allows you to perform authentication based on the parameters provided by the client.

Trait Implementations

impl<S, I, T> Sink<T> for Connection<S, I> where
    T: TryInto<ClientMessage<S::ScalarValue>>,
    T::Error: Error,
    S: Schema,
    I: Init<S::ScalarValue, S::Context> + Send
[src]

type Error = Infallible

The type of value produced by the sink when an error occurs.

impl<S, I> Stream for Connection<S, I> where
    S: Schema,
    I: Init<S::ScalarValue, S::Context>, 
[src]

type Item = ServerMessage<S::ScalarValue>

Values yielded by the stream.

Auto Trait Implementations

impl<S, I> !RefUnwindSafe for Connection<S, I>

impl<S, I> Send for Connection<S, I> where
    I: Send

impl<S, I> !Sync for Connection<S, I>

impl<S, I> Unpin for Connection<S, I>

impl<S, I> !UnwindSafe for Connection<S, I>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, S> IntoFieldResult<T, S> for T where
    T: Stream, 
[src]

type Item = <T as Stream>::Item

Type of items yielded by this [Stream].

impl<T, Item> SinkExt<Item> for T where
    T: Sink<Item> + ?Sized

impl<T> StreamExt for T where
    T: Stream + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.