Struct webrtc_sctp::stream::Stream
source · [−]pub struct Stream { /* private fields */ }
Expand description
Stream represents an SCTP stream
Implementations
sourceimpl Stream
impl Stream
sourcepub fn stream_identifier(&self) -> u16
pub fn stream_identifier(&self) -> u16
stream_identifier returns the Stream identifier associated to the stream.
sourcepub fn set_default_payload_type(
&self,
default_payload_type: PayloadProtocolIdentifier
)
pub fn set_default_payload_type(
&self,
default_payload_type: PayloadProtocolIdentifier
)
set_default_payload_type sets the default payload type used by write.
sourcepub fn set_reliability_params(
&self,
unordered: bool,
rel_type: ReliabilityType,
rel_val: u32
)
pub fn set_reliability_params(
&self,
unordered: bool,
rel_type: ReliabilityType,
rel_val: u32
)
set_reliability_params sets reliability parameters for this stream.
sourcepub async fn read(&self, p: &mut [u8]) -> Result<usize, Error>
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.
sourcepub async fn read_sctp(
&self,
p: &mut [u8]
) -> Result<(usize, PayloadProtocolIdentifier), Error>
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.
sourcepub async fn write(&self, p: &Bytes) -> Result<usize, Error>
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.
sourcepub async fn write_sctp(
&self,
p: &Bytes,
ppi: PayloadProtocolIdentifier
) -> Result<usize, Error>
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.
sourcepub async fn close(&self) -> Result<(), Error>
👎Deprecated
pub async fn close(&self) -> Result<(), Error>
Closes both read and write halves of this stream.
Use Stream::shutdown
instead.
sourcepub async fn shutdown(&self, how: Shutdown) -> Result<(), Error>
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.
sourcepub fn buffered_amount(&self) -> usize
pub fn buffered_amount(&self) -> usize
buffered_amount returns the number of bytes of data currently queued to be sent over this stream.
sourcepub fn buffered_amount_low_threshold(&self) -> usize
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.
sourcepub fn set_buffered_amount_low_threshold(&self, th: usize)
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().
sourcepub async fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
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
Auto Trait Implementations
impl !RefUnwindSafe for Stream
impl Send for Stream
impl Sync for Stream
impl Unpin for Stream
impl !UnwindSafe for Stream
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more