pub trait TcpService:
Clone
+ Send
+ Sync
+ 'static {
type ApplicationProtocols: ApplicationProtocols;
// Required methods
fn available_protocols(&self) -> &[Self::ApplicationProtocols];
fn handle_connection<'life0, 'life1, 'async_trait, S>(
&'life0 self,
connection: S,
peer: &'life1 Peer<Self::ApplicationProtocols>,
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>
where S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A service that can handle incoming TCP connections.
Required Associated Types§
Sourcetype ApplicationProtocols: ApplicationProtocols
type ApplicationProtocols: ApplicationProtocols
The application layer protocols that this service supports.
Required Methods§
Sourcefn available_protocols(&self) -> &[Self::ApplicationProtocols]
fn available_protocols(&self) -> &[Self::ApplicationProtocols]
Returns all available protocols for this service. The first will be the default used if a connection is made without negotiating the application protocol.
Sourcefn handle_connection<'life0, 'life1, 'async_trait, S>(
&'life0 self,
connection: S,
peer: &'life1 Peer<Self::ApplicationProtocols>,
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>where
S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_connection<'life0, 'life1, 'async_trait, S>(
&'life0 self,
connection: S,
peer: &'life1 Peer<Self::ApplicationProtocols>,
) -> Pin<Box<dyn Future<Output = Result<(), S>> + Send + 'async_trait>>where
S: 'async_trait + AsyncRead + AsyncWrite + Unpin + Send + 'static,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle an incoming connection for peer. Return Err(connection) to
have BonsaiDb handle the connection internally.
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.