pub struct Sender { /* private fields */ }
Expand description
Sends byte data over a channel.
Implementations§
source§impl Sender
impl Sender
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 chunk_size(&self) -> usize
pub fn chunk_size(&self) -> usize
Maximum chunk size that can be sent.
This is set by the remote endpoint.
sourcepub fn max_data_size(&self) -> usize
pub fn max_data_size(&self) -> usize
Configured maximum data size of receiver.
This is not a limit for the sender and only provided here for advisory purposes.
sourcepub async fn send(&mut self, data: Bytes) -> Result<(), SendError>
pub async fn send(&mut self, data: Bytes) -> Result<(), SendError>
Sends data over the channel.
Waits until send space becomes available. Data is transmitted in chunks if it exceeds the maximum chunk size.
§Cancel safety
If this function is cancelled before completion, the remote endpoint will receive no data.
sourcepub fn send_chunks(&mut self) -> ChunkSender<'_>
pub fn send_chunks(&mut self) -> ChunkSender<'_>
Streams a message by sending individual chunks.
sourcepub fn try_send(&mut self, data: &Bytes) -> Result<(), TrySendError>
pub fn try_send(&mut self, data: &Bytes) -> Result<(), TrySendError>
Tries to send data over the channel.
Does not wait until send space becomes available. The maximum size of data sendable by this function is limited by the total receive buffer size.
sourcepub async fn connect(
&mut self,
ports: Vec<PortReq>,
wait: bool
) -> Result<Vec<Connect>, SendError>
pub async fn connect( &mut self, ports: Vec<PortReq>, wait: bool ) -> Result<Vec<Connect>, SendError>
Sends port open requests over this port and returns the connect requests.
The receiver limits the number of ports sendable per call, see Receiver::max_ports.
sourcepub fn closed(&self) -> Closed ⓘ
pub fn closed(&self) -> Closed ⓘ
Returns a future that will resolve when the remote endpoint closes its receiver.
sourcepub fn is_graceful_close_overridden(&self) -> bool
pub fn is_graceful_close_overridden(&self) -> bool
Returns whether data can be sent anyway, even if remote endpoint closed the channel gracefully.
Sending always fails if remote endpoint closed the channel non-gracefully, for example by dropping the receiver.
By default this is false.
sourcepub fn set_override_graceful_close(&mut self, override_graceful_close: bool)
pub fn set_override_graceful_close(&mut self, override_graceful_close: bool)
Sets whether data should be sent anyway, even if remote endpoint closed the channel gracefully.
Sending always fails if remote endpoint closed the channel non-gracefully, for example by dropping the receiver.
sourcepub fn into_sink(self) -> SenderSink
pub fn into_sink(self) -> SenderSink
Convert this into a sink.
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.