pub trait SocketPacketWriter: Send {
// Required methods
fn write(
&mut self,
buffer: &[u8],
address: Option<SocketAddress>,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send;
fn write_vectored(
&mut self,
buffers: &[IoSlice<'_>],
address: Option<SocketAddress>,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send;
fn write_owned<B: IoBuf>(
&mut self,
buffer: B,
address: Option<SocketAddress>,
cancellation: &Cancellation,
) -> impl Future<Output = BufferResult<B>> + Send;
fn write_vectored_with_flags(
&mut self,
buffers: &[IoSlice<'_>],
address: Option<SocketAddress>,
flags: SocketSendFlags,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send;
fn write_owned_vectored<Buffers: IoBufSequence>(
&mut self,
buffers: Buffers,
address: Option<SocketAddress>,
flags: SocketSendFlags,
cancellation: &Cancellation,
) -> impl Future<Output = (OperationResult<usize>, Buffers)> + Send;
fn close(&mut self) -> impl Future<Output = Result<()>> + Send;
// Provided method
fn write_with_flags(
&mut self,
buffer: &[u8],
address: Option<SocketAddress>,
flags: SocketSendFlags,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send { ... }
}Expand description
Sequential packet sends through a fixed execution service. Every write is one send attempt, including empty packets; it never splits a packet into separate sends. None uses the connected peer.
If an owned-operation future is abandoned while backend access continues, subsequent operations may report WouldBlock until it retires. Await close to establish retirement; separate handles provide independent lanes.
Required Methods§
fn write( &mut self, buffer: &[u8], address: Option<SocketAddress>, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<usize>> + Send
Sourcefn write_vectored(
&mut self,
buffers: &[IoSlice<'_>],
address: Option<SocketAddress>,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send
fn write_vectored( &mut self, buffers: &[IoSlice<'_>], address: Option<SocketAddress>, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<usize>> + Send
Send the vectors as one packet, preserving their order without advancing them. The returned count is the backend’s single-transfer result.
Sourcefn write_owned<B: IoBuf>(
&mut self,
buffer: B,
address: Option<SocketAddress>,
cancellation: &Cancellation,
) -> impl Future<Output = BufferResult<B>> + Send
fn write_owned<B: IoBuf>( &mut self, buffer: B, address: Option<SocketAddress>, cancellation: &Cancellation, ) -> impl Future<Output = BufferResult<B>> + Send
Retain the owner while sending one packet and return it on success, error, or cancellation. Abandonment drops the owner only after all borrowed access has ended.
Sourcefn write_vectored_with_flags(
&mut self,
buffers: &[IoSlice<'_>],
address: Option<SocketAddress>,
flags: SocketSendFlags,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send
fn write_vectored_with_flags( &mut self, buffers: &[IoSlice<'_>], address: Option<SocketAddress>, flags: SocketSendFlags, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<usize>> + Send
Perform one borrowed vectored transfer with explicit flags. Vectors are never advanced implicitly; a short result leaves their ranges unchanged.
Sourcefn write_owned_vectored<Buffers: IoBufSequence>(
&mut self,
buffers: Buffers,
address: Option<SocketAddress>,
flags: SocketSendFlags,
cancellation: &Cancellation,
) -> impl Future<Output = (OperationResult<usize>, Buffers)> + Send
fn write_owned_vectored<Buffers: IoBufSequence>( &mut self, buffers: Buffers, address: Option<SocketAddress>, flags: SocketSendFlags, cancellation: &Cancellation, ) -> impl Future<Output = (OperationResult<usize>, Buffers)> + Send
Transfer one message using an owned buffer sequence with explicit flags. Return the original sequence and its unchanged ranges on success, error, and cancellation. Kernel or worker access retains the full owner and stable I/O vectors through retirement, including after future abandonment.
Provided Methods§
Sourcefn write_with_flags(
&mut self,
buffer: &[u8],
address: Option<SocketAddress>,
flags: SocketSendFlags,
cancellation: &Cancellation,
) -> impl Future<Output = OperationResult<usize>> + Send
fn write_with_flags( &mut self, buffer: &[u8], address: Option<SocketAddress>, flags: SocketSendFlags, cancellation: &Cancellation, ) -> impl Future<Output = OperationResult<usize>> + Send
Perform one borrowed transfer with explicit portable flags. Payload access ends before each poll returns; successful progress is returned in that poll.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".