Struct h2::proto::streams::streams::Streams

source ·
pub(crate) struct Streams<B, P>
where P: Peer,
{ inner: Arc<Mutex<Inner>>, send_buffer: Arc<SendBuffer<B>>, _p: PhantomData<P>, }

Fields§

§inner: Arc<Mutex<Inner>>

Holds most of the connection and stream related state for processing HTTP/2 frames associated with streams.

§send_buffer: Arc<SendBuffer<B>>

This is the queue of frames to be written to the wire. This is split out to avoid requiring a B generic on all public API types even if B is not technically required.

Currently, splitting this out requires a second Arc + Mutex. However, it should be possible to avoid this duplication with a little bit of unsafe code. This optimization has been postponed until it has been shown to be necessary.

§_p: PhantomData<P>

Implementations§

source§

impl<B, P> Streams<B, P>
where B: Buf, P: Peer,

source

pub fn new(config: Config) -> Self

source

pub fn set_target_connection_window_size( &mut self, size: u32, ) -> Result<(), Reason>

source

pub fn next_incoming(&mut self) -> Option<StreamRef<B>>

source

pub fn send_pending_refusal<T>( &mut self, cx: &mut Context<'_>, dst: &mut Codec<T, Prioritized<B>>, ) -> Poll<Result<()>>
where T: AsyncWrite + Unpin,

source

pub fn clear_expired_reset_streams(&mut self)

source

pub fn poll_complete<T>( &mut self, cx: &mut Context<'_>, dst: &mut Codec<T, Prioritized<B>>, ) -> Poll<Result<()>>
where T: AsyncWrite + Unpin,

source

pub fn apply_remote_settings(&mut self, frame: &Settings) -> Result<(), Error>

source

pub fn apply_local_settings(&mut self, frame: &Settings) -> Result<(), Error>

source

pub fn send_request( &mut self, request: Request<()>, end_of_stream: bool, pending: Option<&OpaqueStreamRef>, ) -> Result<(StreamRef<B>, bool), SendError>

source

pub(crate) fn is_extended_connect_protocol_enabled(&self) -> bool

source§

impl<B> Streams<B, Peer>
where B: Buf,

source

pub fn poll_pending_open( &mut self, cx: &Context<'_>, pending: Option<&OpaqueStreamRef>, ) -> Poll<Result<(), Error>>

source§

impl<B, P> Streams<B, P>
where P: Peer,

source

pub fn as_dyn(&self) -> DynStreams<'_, B>

source

pub fn recv_eof(&mut self, clear_pending_accept: bool) -> Result<(), ()>

This function is safe to call multiple times.

A Result is returned to avoid panicking if the mutex is poisoned.

source

pub(crate) fn max_send_streams(&self) -> usize

source

pub(crate) fn max_recv_streams(&self) -> usize

source

pub fn has_streams(&self) -> bool

source

pub fn has_streams_or_other_references(&self) -> bool

Trait Implementations§

source§

impl<B, P> Clone for Streams<B, P>
where P: Peer,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B: Debug, P> Debug for Streams<B, P>
where P: Peer + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<B, P> Drop for Streams<B, P>
where P: Peer,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<B, P> Freeze for Streams<B, P>

§

impl<B, P> RefUnwindSafe for Streams<B, P>
where P: RefUnwindSafe,

§

impl<B, P> Send for Streams<B, P>
where P: Send, B: Send,

§

impl<B, P> Sync for Streams<B, P>
where P: Sync, B: Send,

§

impl<B, P> Unpin for Streams<B, P>
where P: Unpin,

§

impl<B, P> UnwindSafe for Streams<B, P>
where P: 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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more