Trait message_io::adapter::Remote [−][src]
The resource used to represent a remote. It usually is a wrapper over a socket/stream.
Required methods
fn connect(remote_addr: RemoteAddr) -> Result<ConnectionInfo<Self>>
[src]
Called when the user performs a connection request to an specific remote address.
The implementator is in change of creating the corresponding remote resource.
The RemoteAddr
contains either a SocketAddr
or a url::Url
.
It is in charge of deciding what to do in both cases.
It also must return the extracted address as SocketAddr
.
fn receive(&self, process_data: &dyn Fn(&[u8])) -> ReadStatus
[src]
Called when a remote endpoint received an event.
It means that the resource has available data to read,
or there is some connection related issue, as a disconnection.
The implementator is in charge of processing that action and returns a ReadStatus
.
The process_data
function must be called for each data chunk that represents a message.
This call will produce a Message
API event.
Note that receive()
could imply more than one call to read
.
The implementator must be read all data from the resource.
For most of the cases it means read until the network resource returns WouldBlock
.
fn send(&self, data: &[u8]) -> SendStatus
[src]
Sends a raw data from a resource.
The implementator is in charge to send the entire data
.
The SendStatus
will contain the status of this attempt.