[−][src]Trait solicit::http::session::SessionState
A trait defining a set of methods for accessing and influencing an HTTP/2 session's state.
This trait is tightly coupled to a Stream
-based session layer implementation. Particular
implementations are additionally tightly coupled to one particular Stream
implementation.
Note
Clients built on top of the raw HttpConnection
+ Session
can still exist without using
this trait; however, it is included for convenience, as most session implementations will
want to keep track of similar things in the session's state.
Associated Types
Loading content...Required methods
fn insert_outgoing(&mut self, stream: Self::Stream) -> StreamId
Inserts the given Stream
into the session's state, starting to track it.
The SessionState
should assign it the next available outgoing stream ID.
fn insert_incoming(
&mut self,
id: StreamId,
stream: Self::Stream
) -> Result<(), ()>
&mut self,
id: StreamId,
stream: Self::Stream
) -> Result<(), ()>
Inserts the given Stream
into the session's state, considering it an incoming
stream.
TODO(mlalic): Allow the exact error to propagate out.
fn get_stream_ref(&self, stream_id: StreamId) -> Option<&Self::Stream>
Returns a reference to a Stream
with the given StreamId
, if it is found in the current
session.
fn get_stream_mut(&mut self, stream_id: StreamId) -> Option<&mut Self::Stream>
Returns a mutable reference to a Stream
with the given StreamId
, if it is found in the
current session.
fn remove_stream(&mut self, stream_id: StreamId) -> Option<Self::Stream>
Removes the stream with the given StreamId
from the session. If the stream was found in
the session, it is returned in the result.
fn iter(&mut self) -> StreamIter<Self::Stream>
Returns an iterator over the streams currently found in the session.
fn len(&self) -> usize
The number of streams tracked by this state object
Provided methods
fn get_closed(&mut self) -> Vec<Self::Stream>
Returns all streams that are closed and tracked by the session state.
The streams are moved out of the session state.
The default implementations relies on the iter
implementation to find the closed streams
first and then calls remove_stream
on all of them.
Implementors
impl<T, S> SessionState for DefaultSessionState<T, S> where
S: Stream,
[src]
S: Stream,
type Stream = S
fn insert_outgoing(&mut self, stream: Self::Stream) -> StreamId
[src]
fn insert_incoming(
&mut self,
stream_id: StreamId,
stream: Self::Stream
) -> Result<(), ()>
[src]
&mut self,
stream_id: StreamId,
stream: Self::Stream
) -> Result<(), ()>
fn get_stream_ref(&self, stream_id: StreamId) -> Option<&Self::Stream>
[src]
fn get_stream_mut(&mut self, stream_id: StreamId) -> Option<&mut Self::Stream>
[src]
fn remove_stream(&mut self, stream_id: StreamId) -> Option<Self::Stream>
[src]
fn iter(&mut self) -> StreamIter<S>
[src]
fn len(&self) -> usize
[src]
Number of currently active streams