pub trait Write<E> {
// Required methods
fn write(&mut self, buf: &[u8]) -> Result<u16, E>;
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error<E>>;
fn send(self) -> Result<(), E>;
}
Expand description
Socket writer trait.
Required Methods§
sourcefn write(&mut self, buf: &[u8]) -> Result<u16, E>
fn write(&mut self, buf: &[u8]) -> Result<u16, E>
Write data to the socket buffer, and return the number of bytes written.
sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), Error<E>>
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error<E>>
Writes all the data, returning Error::OutOfMemory
if the size of
buf
exceeds the free memory available in the socket buffer.
Errors
This method can only return:
sourcefn send(self) -> Result<(), E>
fn send(self) -> Result<(), E>
Send all data previously written with write
and write_all
.
For UDP sockets the destination is set by the last call to
Registers::set_sn_dest
, Udp::udp_send_to
, or
UdpWriter::udp_send_to
.