Struct Stream

Source
pub struct Stream { /* private fields */ }
Expand description

Stream represents an SCTP stream

Implementations§

Source§

impl Stream

Source

pub fn stream_identifier(&self) -> u16

stream_identifier returns the Stream identifier associated to the stream.

Source

pub fn set_default_payload_type( &self, default_payload_type: PayloadProtocolIdentifier, )

set_default_payload_type sets the default payload type used by write.

Source

pub fn set_reliability_params( &self, unordered: bool, rel_type: ReliabilityType, rel_val: u32, )

set_reliability_params sets reliability parameters for this stream.

Source

pub async fn read(&self, p: &mut [u8]) -> Result<usize, Error>

read reads a packet of len(p) bytes, dropping the Payload Protocol Identifier. Returns EOF when the stream is reset or an error if the stream is closed otherwise.

Source

pub async fn read_sctp( &self, p: &mut [u8], ) -> Result<(usize, PayloadProtocolIdentifier), Error>

read_sctp reads a packet of len(p) bytes and returns the associated Payload Protocol Identifier. Returns EOF when the stream is reset or an error if the stream is closed otherwise.

Source

pub async fn write(&self, p: &Bytes) -> Result<usize, Error>

write writes len(p) bytes from p with the default Payload Protocol Identifier

Source

pub async fn write_sctp( &self, p: &Bytes, ppi: PayloadProtocolIdentifier, ) -> Result<usize, Error>

write_sctp writes len(p) bytes from p to the DTLS connection

Source

pub async fn close(&self) -> Result<(), Error>

Close closes the write-direction of the stream. Future calls to write are not permitted after calling Close.

Source

pub fn buffered_amount(&self) -> usize

buffered_amount returns the number of bytes of data currently queued to be sent over this stream.

Source

pub fn buffered_amount_low_threshold(&self) -> usize

buffered_amount_low_threshold returns the number of bytes of buffered outgoing data that is considered “low.” Defaults to 0.

Source

pub fn set_buffered_amount_low_threshold(&self, th: usize)

set_buffered_amount_low_threshold is used to update the threshold. See buffered_amount_low_threshold().

Source

pub async fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)

on_buffered_amount_low sets the callback handler which would be called when the number of bytes of outgoing data buffered is lower than the threshold.

Trait Implementations§

Source§

impl Debug for Stream

Source§

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

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

impl Default for Stream

Source§

fn default() -> Stream

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Stream

§

impl !RefUnwindSafe for Stream

§

impl Send for Stream

§

impl Sync for Stream

§

impl Unpin for Stream

§

impl !UnwindSafe for Stream

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