Trait SocketService
pub trait SocketService:
Send
+ Sync
+ 'static {
type Socket: Send + 'static;
type Error: Into<Box<dyn Error + Sync + Send>> + Send + 'static;
// Required method
fn bind_socket_with_address(
&self,
addr: impl Into<SocketAddress>,
) -> impl Future<Output = Result<Self::Socket, Self::Error>> + Send;
}Expand description
Glue trait that is used as the trait bound for code creating/preparing a socket on one layer or another.
Can also be manually implemented as an alternative Service trait,
but from a Rama POV it is mostly used for UX trait bounds.
Required Associated Types§
type Socket: Send + 'static
type Socket: Send + 'static
Socket returned by the SocketService
Required Methods§
fn bind_socket_with_address(
&self,
addr: impl Into<SocketAddress>,
) -> impl Future<Output = Result<Self::Socket, Self::Error>> + Send
fn bind_socket_with_address( &self, addr: impl Into<SocketAddress>, ) -> impl Future<Output = Result<Self::Socket, Self::Error>> + Send
Create a binding to a Unix/Linux/Windows socket.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.