pub struct DataChannel {
pub config: Config,
/* private fields */
}
Expand description
DataChannel represents a data channel
Fields§
§config: Config
Implementations§
Source§impl DataChannel
impl DataChannel
pub fn new(stream: Arc<Stream>, config: Config) -> Self
Sourcepub async fn dial(
association: &Arc<Association>,
identifier: u16,
config: Config,
) -> Result<Self, Error>
pub async fn dial( association: &Arc<Association>, identifier: u16, config: Config, ) -> Result<Self, Error>
Dial opens a data channels over SCTP
Sourcepub async fn accept<T>(
association: &Arc<Association>,
config: Config,
existing_channels: &[T],
) -> Result<Self, Error>where
T: Borrow<Self>,
pub async fn accept<T>(
association: &Arc<Association>,
config: Config,
existing_channels: &[T],
) -> Result<Self, Error>where
T: Borrow<Self>,
Accept is used to accept incoming data channels over SCTP
Sourcepub async fn client(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
pub async fn client(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
Client opens a data channel over an SCTP stream
Sourcepub async fn server(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
pub async fn server(stream: Arc<Stream>, config: Config) -> Result<Self, Error>
Server accepts a data channel over an SCTP stream
Sourcepub async fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
pub async fn read(&self, buf: &mut [u8]) -> Result<usize, Error>
Read reads a packet of len(p) bytes as binary data.
Sourcepub async fn read_data_channel(
&self,
buf: &mut [u8],
) -> Result<(usize, bool), Error>
pub async fn read_data_channel( &self, buf: &mut [u8], ) -> Result<(usize, bool), Error>
ReadDataChannel reads a packet of len(p) bytes. It returns the number of bytes read and
true
if the data read is a string.
Sourcepub fn messages_sent(&self) -> usize
pub fn messages_sent(&self) -> usize
MessagesSent returns the number of messages sent
Sourcepub fn messages_received(&self) -> usize
pub fn messages_received(&self) -> usize
MessagesReceived returns the number of messages received
Sourcepub fn bytes_sent(&self) -> usize
pub fn bytes_sent(&self) -> usize
BytesSent returns the number of bytes sent
Sourcepub fn bytes_received(&self) -> usize
pub fn bytes_received(&self) -> usize
BytesReceived returns the number of bytes received
Sourcepub fn stream_identifier(&self) -> u16
pub fn stream_identifier(&self) -> u16
StreamIdentifier returns the Stream identifier associated to the stream.
Sourcepub async fn write(&self, data: &Bytes) -> Result<usize, Error>
pub async fn write(&self, data: &Bytes) -> Result<usize, Error>
Write writes len(p) bytes from p as binary data
Sourcepub async fn write_data_channel(
&self,
data: &Bytes,
is_string: bool,
) -> Result<usize, Error>
pub async fn write_data_channel( &self, data: &Bytes, is_string: bool, ) -> Result<usize, Error>
WriteDataChannel writes len(p) bytes from p
Sourcepub async fn close(&self) -> Result<(), Error>
pub async fn close(&self) -> Result<(), Error>
Close closes the DataChannel and the underlying SCTP stream.
Sourcepub fn buffered_amount(&self) -> usize
pub fn buffered_amount(&self) -> usize
BufferedAmount 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
BufferedAmountLowThreshold returns the number of bytes of buffered outgoing data that is considered “low.” Defaults to 0.
Sourcepub fn set_buffered_amount_low_threshold(&self, threshold: usize)
pub fn set_buffered_amount_low_threshold(&self, threshold: usize)
SetBufferedAmountLowThreshold is used to update the threshold. See BufferedAmountLowThreshold().
Sourcepub fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
pub fn on_buffered_amount_low(&self, f: OnBufferedAmountLowFn)
OnBufferedAmountLow 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<DataChannel> for PollDataChannel
impl AsRef<DataChannel> for PollDataChannel
Source§fn as_ref(&self) -> &DataChannel
fn as_ref(&self) -> &DataChannel
Source§impl Clone for DataChannel
impl Clone for DataChannel
Source§fn clone(&self) -> DataChannel
fn clone(&self) -> DataChannel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more