pub trait SocketHandler {
// Required methods
fn socket_read(&mut self, buf: &mut [u8]) -> (usize, SocketResult);
fn socket_write(&mut self, buf: &[u8]) -> (usize, SocketResult);
fn socket_write_vectored(
&mut self,
_buf: &[IoSlice<'_>],
) -> (usize, SocketResult);
fn socket_ref(&self) -> &TcpStream;
fn socket_mut(&mut self) -> &mut TcpStream;
fn protocol(&self) -> TransportProtocol;
fn read_error(&self);
fn write_error(&self);
// Provided methods
fn socket_wants_write(&self) -> bool { ... }
fn socket_close(&mut self) { ... }
fn session_ulid(&self) -> Option<Ulid> { ... }
}Required Methods§
fn socket_read(&mut self, buf: &mut [u8]) -> (usize, SocketResult)
fn socket_write(&mut self, buf: &[u8]) -> (usize, SocketResult)
fn socket_write_vectored( &mut self, _buf: &[IoSlice<'_>], ) -> (usize, SocketResult)
fn socket_ref(&self) -> &TcpStream
fn socket_mut(&mut self) -> &mut TcpStream
fn protocol(&self) -> TransportProtocol
fn read_error(&self)
fn write_error(&self)
Provided Methods§
fn socket_wants_write(&self) -> bool
fn socket_close(&mut self)
Sourcefn session_ulid(&self) -> Option<Ulid>
fn session_ulid(&self) -> Option<Ulid>
Returns the owning connection’s session ULID when known. Used by
[log_socket_context!] to render the [<session_ulid> - - -] segment
of the socket-layer log prefix, matching the format used by the
rest of the mux stack. Returns None for contextless implementations
(e.g. raw mio::TcpStream); the macro renders - in the ULID slot.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".