ServerConnection

Struct ServerConnection 

Source
pub struct ServerConnection<S, R, State = DefaultSessionState<DefaultStream>>
where S: SendFrame, R: ReceiveFrame, State: SessionState,
{ pub state: State, /* private fields */ }
Expand description

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§

Source§

impl<S, R, State> ServerConnection<S, R, State>
where S: SendFrame, R: ReceiveFrame, State: SessionState,

Source

pub fn with_connection( conn: HttpConnection<S, R>, state: State, ) -> ServerConnection<S, R, State>

Creates a new ServerConnection that will use the given HttpConnection for its underlying HTTP/2 communication.

Source

pub fn scheme(&self) -> HttpScheme

Returns the scheme of the underlying HttpConnection.

Source

pub fn init(&mut self) -> HttpResult<()>

Initializes the ServerConnection by sending the server’s settings and processing the client’s. If the client does not provide a settings frame, returns an error.

TODO This method should eventually be split into two.

Source

pub fn handle_next_frame(&mut self) -> HttpResult<()>

Fully handles the next incoming frame. Events are passed on to the internal session instance.

Source

pub fn start_response( &mut self, headers: Vec<Header>, stream_id: StreamId, end_stream: EndStream, ) -> HttpResult<()>

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

Source

pub fn send_next_data(&mut self) -> HttpResult<SendStatus>

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<S, R, State> Freeze for ServerConnection<S, R, State>
where State: Freeze, R: Freeze, S: Freeze,

§

impl<S, R, State> RefUnwindSafe for ServerConnection<S, R, State>

§

impl<S, R, State> Send for ServerConnection<S, R, State>
where State: Send, R: Send, S: Send,

§

impl<S, R, State> Sync for ServerConnection<S, R, State>
where State: Sync, R: Sync, S: Sync,

§

impl<S, R, State> Unpin for ServerConnection<S, R, State>
where State: Unpin, R: Unpin, S: Unpin,

§

impl<S, R, State> UnwindSafe for ServerConnection<S, R, State>
where State: UnwindSafe, R: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.