Trait samotop::smtp::SessionService
source · [−]pub trait SessionService: Debug {
fn prepare_session<'a, 'i, 's, 'f>(
&'a self,
io: &'i mut Box<dyn MayBeTls + 'static, Global>,
state: &'s mut SmtpContext
) -> Pin<Box<dyn Future<Output = ()> + Send + 'f, Global>>ⓘ
where
'a: 'f,
'i: 'f,
's: 'f;
}
Expand description
The service which implements this trait delivers ESMTP extensions.
use samotop_core::common::*;
use samotop_core::smtp::*;
use samotop_core::io::tls::MayBeTls;
use std::time::Duration;
/// This mail service can handle 8-bit MIME
#[derive(Clone, Debug)]
pub struct EnableEightBit;
impl SessionService for EnableEightBit
{
fn prepare_session<'a, 'i, 's, 'f>(
&'a self,
_io: &'i mut Box<dyn MayBeTls>,
state: &'s mut SmtpContext,
) -> S1Fut<'f, ()>
where
'a: 'f,
'i: 'f,
's: 'f
{
Box::pin(async move {
state.session
.extensions
.enable(&extension::EIGHTBITMIME);
})
}
}