Trait trillium_server_common::Acceptor
source · pub trait Acceptor<Input>: Clone + Send + Sync + 'staticwhere
Input: Transport,{
type Output: Transport;
type Error: Debug + Send + Sync;
// Required method
fn accept<'life0, 'async_trait>(
&'life0 self,
input: Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
This trait provides the common interface for server-side tls acceptors, abstracting over various implementations
The only implementation provided by this crate is ()
, which is
a noop acceptor, and passes through the Input
type.
Implementing this trait looks like:
ⓘ
use trillium_server_common::{AsyncRead, AsyncWrite, async_trait, Transport};
#[async_trait]
impl<Input> Acceptor<Input> for my_tls_impl::Acceptor
where
Input: Transport,
{
type Output = my_tls_impl::TlsStream<Input>;
type Error = my_tls_impl::Error;
async fn accept(&self, input: Input) -> Result<Self::Output, Self::Error> {
self.accept(input).await
}
}
Required Associated Types§
Required Methods§
sourcefn accept<'life0, 'async_trait>(
&'life0 self,
input: Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn accept<'life0, 'async_trait>(
&'life0 self,
input: Input,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Transform an Input (AsyncRead + AsyncWrite + Send + Sync + Unpin + 'static
) into Self::Output
Async trait signature:
ⓘ
async fn accept(&self, input: Input) -> Result<Self::Output, Self::Error>;
Object Safety§
This trait is not object safe.