Struct webrtc_sctp::stream::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>

Reads a packet of len(p) bytes, dropping the Payload Protocol Identifier.

Returns Error::ErrShortBuffer if p is too short. Returns 0 if the reading half of this stream is shutdown or it (the stream) was reset.

source

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

Reads a packet of len(p) bytes and returns the associated Payload Protocol Identifier.

Returns Error::ErrShortBuffer if p is too short. Returns (0, PayloadProtocolIdentifier::Unknown) if the reading half of this stream is shutdown or it (the stream) was reset.

source

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

Writes p to the DTLS connection with the default Payload Protocol Identifier.

Returns an error if the write half of this stream is shutdown or p is too large.

source

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

Writes p to the DTLS connection with the given Payload Protocol Identifier.

Returns an error if the write half of this stream is shutdown or p is too large.

source

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

👎Deprecated

Closes both read and write halves of this stream.

Use Stream::shutdown instead.

source

pub async fn shutdown(&self, how: Shutdown) -> Result<(), Error>

Shuts down the read, write, or both halves of this stream.

This function will cause all pending and future I/O on the specified portions to return immediately with an appropriate value (see the documentation of Shutdown).

Resets the stream when both halves of this stream are shutdown.

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 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 AsRef<Stream> for PollStream

source§

fn as_ref(&self) -> &Stream

Converts this type into a shared reference of the (usually inferred) input type.
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>,

§

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

source§

fn vzip(self) -> V