Skip to main content

Streams

Struct Streams 

Source
pub struct Streams {
    pub send_max_data: u64,
    pub control: VecDeque<Control>,
    pub events: VecDeque<StreamEvent>,
    /* private fields */
}

Fields§

§send_max_data: u64§control: VecDeque<Control>§events: VecDeque<StreamEvent>

Implementations§

Source§

impl Streams

Source

pub fn new(is_server: bool, cfg: StreamConfig) -> Self

Source

pub fn set_peer_params(&mut self, p: &TransportParams)

Applies the peer’s transport parameters.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn open(&mut self, bidi: bool) -> Result<u64, StreamError>

Opens a locally initiated stream.

Source

pub fn on_stream( &mut self, id: u64, off: u64, data: &[u8], fin: bool, ) -> Result<(), TransportError>

Source

pub fn on_reset( &mut self, id: u64, code: u64, final_size: u64, ) -> Result<(), TransportError>

Source

pub fn on_stop_sending( &mut self, id: u64, code: u64, ) -> Result<(), TransportError>

Source

pub fn on_max_stream_data( &mut self, id: u64, max: u64, ) -> Result<(), TransportError>

Source

pub fn on_stream_data_blocked(&mut self, id: u64) -> Result<(), TransportError>

Source

pub fn on_max_data(&mut self, max: u64)

Source

pub fn on_max_streams(&mut self, bidi: bool, max: u64)

Source

pub fn on_streams_blocked(&mut self, bidi: bool, limit: u64)

Source

pub fn write( &mut self, id: u64, data: &[u8], fin: bool, ) -> Result<usize, StreamError>

Buffers data for sending; returns how many bytes were accepted.

Source

pub fn read( &mut self, id: u64, out: &mut [u8], ) -> Result<(usize, bool), StreamError>

Reads in-order data; returns (bytes, fin reached).

Source

pub fn reset(&mut self, id: u64, code: u64) -> Result<(), StreamError>

Abandons sending with RESET_STREAM.

Source

pub fn stop(&mut self, id: u64, code: u64) -> Result<(), StreamError>

Asks the peer to stop sending with STOP_SENDING; buffered data is discarded.

Source

pub fn has_pending_data(&self) -> bool

Source

pub fn write_frames( &mut self, out: &mut Vec<u8>, limit: usize, sent: &mut Vec<SentFrame>, )

Writes STREAM frames into out while at least min_room bytes are left before limit; records (id, off, len, fin) in sent.

Source

pub fn write_control( &mut self, c: Control, out: &mut Vec<u8>, limit: usize, ) -> Option<bool>

Writes one control frame if it fits; returns false when it does not.

Source

pub fn on_stream_acked(&mut self, id: u64, off: u64, len: u64, fin: bool)

Source

pub fn on_stream_lost(&mut self, id: u64, off: u64, len: u64, fin: bool)

Source

pub fn on_reset_acked(&mut self, id: u64)

Source

pub fn contains(&self, id: u64) -> bool

True if the stream exists.

Source

pub fn unacked(&self, id: u64) -> Option<u64>

Bytes buffered and not yet acknowledged on a send stream.

Source

pub fn writable(&self, id: u64) -> Option<u64>

How many more bytes write would accept now.

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<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 = !

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

fn try_from(value: U) -> Result<T, !>

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.