use crate::Transport;
use std::{convert::Infallible, fmt::Debug, future::Future};
pub trait Acceptor<Input>: Clone + Send + Sync + 'static
where
Input: Transport,
{
type Output: Transport;
type Error: Debug + Send + Sync;
fn accept(
&self,
input: Input,
) -> impl Future<Output = Result<Self::Output, Self::Error>> + Send;
fn is_secure(&self) -> bool {
true
}
}
impl<Input> Acceptor<Input> for ()
where
Input: Transport,
{
type Error = Infallible;
type Output = Input;
async fn accept(&self, input: Input) -> Result<Self::Output, Self::Error> {
Ok(input)
}
fn is_secure(&self) -> bool {
false
}
}