pub struct Receiver { /* private fields */ }Expand description
Receives byte data over a channel.
Implementations§
source§impl Receiver
impl Receiver
sourcepub fn local_port(&self) -> u32
pub fn local_port(&self) -> u32
The local port number.
sourcepub fn remote_port(&self) -> u32
pub fn remote_port(&self) -> u32
The remote port number.
sourcepub fn max_data_size(&self) -> usize
pub fn max_data_size(&self) -> usize
Maximum data size in bytes to receive per message.
The default value is specified by Cfg::max_data_size.
recv_chunk is not affected by this limit.
sourcepub fn set_max_data_size(&mut self, max_data_size: usize)
pub fn set_max_data_size(&mut self, max_data_size: usize)
Set maximum data size in bytes to receive per message.
recv_chunk is not affected by this limit.
sourcepub fn max_ports(&self) -> usize
pub fn max_ports(&self) -> usize
Maximum port count per message.
The default value is specified by Cfg::max_received_ports.
sourcepub fn set_max_ports(&mut self, max_ports: usize)
pub fn set_max_ports(&mut self, max_ports: usize)
Set maximum port count per message.
sourcepub async fn recv(&mut self) -> Result<Option<DataBuf>, RecvError>
pub async fn recv(&mut self) -> Result<Option<DataBuf>, RecvError>
Receives data over the channel.
Waits for data to become available. Received port open requests are silently rejected. The size of the received data is limited by max_data_size.
sourcepub async fn recv_chunk(&mut self) -> Result<Option<Bytes>, RecvChunkError>
pub async fn recv_chunk(&mut self) -> Result<Option<Bytes>, RecvChunkError>
Receives chunks of data over the channel.
This should be called when recv_any returns Received::Chunks to obtain the received data chunk by chunk. None is returned after the last chunk of a message.
This is unlimited in size.
sourcepub async fn recv_any(&mut self) -> Result<Option<Received>, RecvError>
pub async fn recv_any(&mut self) -> Result<Option<Received>, RecvError>
Receives data or ports over the channel.
sourcepub async fn close(&mut self)
pub async fn close(&mut self)
Closes the sender at the remote endpoint, preventing it from sending new data. Already sent message will still be received.
sourcepub fn into_stream(self) -> ReceiverStream
👎Deprecated: use ReceiverStream::from instead
pub fn into_stream(self) -> ReceiverStream
Convert this into a stream.
sourcepub fn port_allocator(&self) -> PortAllocator
pub fn port_allocator(&self) -> PortAllocator
Returns the port allocator of the channel multiplexer.
sourcepub fn storage(&self) -> AnyStorage
pub fn storage(&self) -> AnyStorage
Returns the arbitrary data storage of the channel multiplexer.