[][src]Struct solicit::http::server::ServerConnection

pub struct ServerConnection<F, State = DefaultSessionState<ServerMarker, DefaultStream>> where
    State: SessionState,
    F: StreamFactory<Stream = State::Stream>, 
{ pub state: State, // some fields omitted }

The struct provides a more convenient API for server-related functionality of an HTTP/2 connection, such as sending a response back to the client.

Fields

state: State

The state of the session associated to this client connection. Maintains the status of the connection streams.

Implementations

impl<F, State> ServerConnection<F, State> where
    State: SessionState,
    F: StreamFactory<Stream = State::Stream>, 
[src]

pub fn with_connection(
    conn: HttpConnection,
    state: State,
    factory: F
) -> ServerConnection<F, State>
[src]

Creates a new ServerConnection that will use the given HttpConnection for its underlying HTTP/2 communication. The state and factory represent, respectively, the initial state of the connection and an instance of the StreamFactory type (allowing the client to handle newly created streams).

pub fn scheme(&self) -> HttpScheme[src]

Returns the scheme of the underlying HttpConnection.

pub fn send_settings<S: SendFrame>(&mut self, sender: &mut S) -> HttpResult<()>[src]

Send the current settings associated to the ServerConnection to the client.

pub fn expect_settings<Recv: ReceiveFrame, Sender: SendFrame>(
    &mut self,
    rx: &mut Recv,
    tx: &mut Sender
) -> HttpResult<()>
[src]

Handles the next frame on the given ReceiveFrame instance and expects it to be a (non-ACK) SETTINGS frame. Returns an error if not.

pub fn handle_next_frame<Recv: ReceiveFrame, Sender: SendFrame>(
    &mut self,
    rx: &mut Recv,
    tx: &mut Sender
) -> HttpResult<()>
[src]

Fully handles the next frame provided by the given ReceiveFrame instance. Handling the frame can cause the session state of the ServerConnection to update.

pub fn start_response<'n, 'v, S: SendFrame>(
    &mut self,
    headers: Vec<Header<'n, 'v>>,
    stream_id: StreamId,
    end_stream: EndStream,
    sender: &mut S
) -> HttpResult<()>
[src]

Starts a response on the stream with the given ID by sending the given headers.

The body of the response is assumed to be provided by the Stream instance stored within the connection's state. (The body does not have to be ready when this method is called, as long as the Stream instance knows how to provide it to the connection later on.)

pub fn send_next_data<S: SendFrame>(
    &mut self,
    sender: &mut S
) -> HttpResult<SendStatus>
[src]

Queues a new DATA frame onto the underlying SendFrame.

Currently, no prioritization of streams is taken into account and which stream's data is queued cannot be relied on.

Auto Trait Implementations

impl<F, State> RefUnwindSafe for ServerConnection<F, State> where
    F: RefUnwindSafe,
    State: RefUnwindSafe

impl<F, State> Send for ServerConnection<F, State> where
    F: Send,
    State: Send

impl<F, State> Sync for ServerConnection<F, State> where
    F: Sync,
    State: Sync

impl<F, State> Unpin for ServerConnection<F, State> where
    F: Unpin,
    State: Unpin

impl<F, State> UnwindSafe for ServerConnection<F, State> where
    F: UnwindSafe,
    State: UnwindSafe

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, 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.