pub trait SoeSocket {
// Required methods
fn local_addr(&self) -> Result<SocketAddr>;
fn session_count(&self) -> usize;
fn connect(&mut self, remote: SocketAddr);
fn enqueue_data(&mut self, remote: &SocketAddr, data: &[u8]) -> bool;
fn terminate(&mut self, remote: &SocketAddr, reason: DisconnectReason);
}Expand description
A driver-agnostic surface for managing SOE sessions over a UDP socket.
Implemented by the concrete socket drivers — crate::sync_rt::SyncSoeSocket
and (with the tokio feature) TokioSoeSocket — so that
application code can be written generically over the driver.
The I/O drive step itself differs between drivers (a blocking step versus an
async fn step) and so is provided as an inherent method on each type rather
than on this trait.
Required Methods§
Sourcefn local_addr(&self) -> Result<SocketAddr>
fn local_addr(&self) -> Result<SocketAddr>
Returns the local address the underlying socket is bound to.
Sourcefn session_count(&self) -> usize
fn session_count(&self) -> usize
Returns the number of active sessions.
Sourcefn connect(&mut self, remote: SocketAddr)
fn connect(&mut self, remote: SocketAddr)
Opens a client session to remote. The session request is sent on the next
drive step.
Sourcefn enqueue_data(&mut self, remote: &SocketAddr, data: &[u8]) -> bool
fn enqueue_data(&mut self, remote: &SocketAddr, data: &[u8]) -> bool
Enqueues application data to be sent reliably to remote. Returns false if
there is no running session for that address.
Sourcefn terminate(&mut self, remote: &SocketAddr, reason: DisconnectReason)
fn terminate(&mut self, remote: &SocketAddr, reason: DisconnectReason)
Terminates the session with remote, notifying the remote party.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".