Skip to main content

StreamState

Struct StreamState 

Source
pub struct StreamState {
    pub id: u16,
    pub status: StreamStatus,
    pub send_buffer: VecDeque<Bytes>,
    pub recv_buffer: VecDeque<Bytes>,
    pub window_size: u32,
    pub bytes_sent: AtomicU64,
    pub bytes_received: AtomicU64,
    pub error: Option<String>,
    /* private fields */
}
Expand description

Stream state

Fields§

§id: u16

Stream ID

§status: StreamStatus

Current status

§send_buffer: VecDeque<Bytes>

Send buffer

§recv_buffer: VecDeque<Bytes>

Receive buffer

§window_size: u32

Flow control window size

§bytes_sent: AtomicU64

Bytes sent

§bytes_received: AtomicU64

Bytes received

§error: Option<String>

Error message if stream was reset

Implementations§

Source§

impl StreamState

Source

pub fn new(id: u16) -> Self

Create a new stream state

Source

pub fn queue_send(&mut self, data: Bytes) -> Result<(), MultiplexError>

Queue data for sending

Source

pub fn queue_recv( &mut self, data: Bytes, max_recv_buffer_bytes: usize, ) -> Result<(), MultiplexError>

Queue received data

Source

pub fn take_send(&mut self) -> Option<Bytes>

Take next data from send buffer

Source

pub fn take_recv(&mut self) -> Option<Bytes>

Take next data from receive buffer

Source

pub fn close_local(&mut self)

Close local side of stream

Source

pub fn close_remote(&mut self)

Close remote side of stream

Source

pub fn reset(&mut self, error: Option<String>)

Reset stream with error

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V