Struct h2::proto::connection::Connection

source ·
pub(crate) struct Connection<T, P, B: Buf = Bytes>
where P: Peer,
{ codec: Codec<T, Prioritized<B>>, inner: ConnectionInner<P, B>, }
Expand description

An H2 connection

Fields§

§codec: Codec<T, Prioritized<B>>

Read / write frame values

§inner: ConnectionInner<P, B>

Implementations§

source§

impl<T, P, B> Connection<T, P, B>
where T: AsyncRead + AsyncWrite + Unpin, P: Peer, B: Buf,

source

pub fn new( codec: Codec<T, Prioritized<B>>, config: Config, ) -> Connection<T, P, B>

source

pub(crate) fn set_target_window_size(&mut self, size: u32)

connection flow control

source

pub(crate) fn set_initial_window_size( &mut self, size: u32, ) -> Result<(), UserError>

Send a new SETTINGS frame with an updated initial window size.

source

pub(crate) fn set_enable_connect_protocol(&mut self) -> Result<(), UserError>

Send a new SETTINGS frame with extended CONNECT protocol enabled.

source

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

Returns the maximum number of concurrent streams that may be initiated by this peer.

source

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

Returns the maximum number of concurrent streams that may be initiated by the remote peer.

source

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>

Returns Ready when the connection is ready to receive a frame.

Returns Error as this may raise errors that are caused by delayed processing of received frames.

source

fn poll_go_away(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<Reason>>>

Send any pending GOAWAY frames.

This will return Some(reason) if the connection should be closed afterwards. If this is a graceful shutdown, this returns None.

source

pub fn go_away_from_user(&mut self, e: Reason)

source

fn take_error( &mut self, ours: Reason, initiator: Initiator, ) -> Result<(), Error>

source

pub fn maybe_close_connection_if_no_streams(&mut self)

Closes the connection by transitioning to a GOAWAY state iff there are no streams or references

source

pub(crate) fn take_user_pings(&mut self) -> Option<UserPings>

source

pub fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>

Advances the internal state of the connection.

source

fn poll2(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>

source

fn clear_expired_reset_streams(&mut self)

source§

impl<T, B> Connection<T, Peer, B>
where T: AsyncRead + AsyncWrite, B: Buf,

source

pub(crate) fn streams(&self) -> &Streams<B, Peer>

source§

impl<T, B> Connection<T, Peer, B>
where T: AsyncRead + AsyncWrite + Unpin, B: Buf,

source

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

source

pub fn go_away_gracefully(&mut self)

Trait Implementations§

source§

impl<T: Debug, P, B: Debug + Buf> Debug for Connection<T, P, B>
where P: Peer + Debug,

source§

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

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

impl<T, P, B> Drop for Connection<T, P, B>
where P: Peer, B: Buf,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<T, P, B = Bytes> !Freeze for Connection<T, P, B>

§

impl<T, P, B = Bytes> !RefUnwindSafe for Connection<T, P, B>

§

impl<T, P, B> Send for Connection<T, P, B>
where P: Send, T: Send, B: Send,

§

impl<T, P, B> Sync for Connection<T, P, B>
where P: Sync, T: Sync, B: Sync + Send,

§

impl<T, P, B> Unpin for Connection<T, P, B>
where P: Unpin, T: Unpin,

§

impl<T, P, B = Bytes> !UnwindSafe for Connection<T, P, B>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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