pub struct Callbacks<T: Send> {Show 13 fields
pub negotiate: Option<Box<dyn for<'cx> Fn(&'cx mut NegotiateContext<T>, Actions, ProtoOpts) -> CallbackFuture<'cx> + Send + Sync>>,
pub connect: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString, SocketInfo) -> CallbackFuture<'cx> + Send + Sync>>,
pub helo: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString) -> CallbackFuture<'cx> + Send + Sync>>,
pub mail: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, Vec<CString>) -> CallbackFuture<'cx> + Send + Sync>>,
pub rcpt: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, Vec<CString>) -> CallbackFuture<'cx> + Send + Sync>>,
pub data: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>,
pub header: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString, CString) -> CallbackFuture<'cx> + Send + Sync>>,
pub eoh: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>,
pub body: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, Bytes) -> CallbackFuture<'cx> + Send + Sync>>,
pub eom: Option<Box<dyn for<'cx> Fn(&'cx mut EomContext<T>) -> CallbackFuture<'cx> + Send + Sync>>,
pub abort: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>,
pub close: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>,
pub unknown: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString) -> CallbackFuture<'cx> + Send + Sync>>,
}Expand description
Callback closures for each milter stage.
Consult the sendmail documentation for the purpose of each callback and the meaning of its arguments. Here is an overview of the callback flow:
The callbacks indicated may be called repeatedly.
The SMTP protocol allows multiple messages to be transmitted in a single connection, so the message-scoped callback flow may be traversed multiple times.
During the message-scoped stages, abort is called when
processing of the current message is aborted.
The callback unknown is called for unknown SMTP
commands.
Fields§
§negotiate: Option<Box<dyn for<'cx> Fn(&'cx mut NegotiateContext<T>, Actions, ProtoOpts) -> CallbackFuture<'cx> + Send + Sync>>The callback for the negotiate stage.
connect: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString, SocketInfo) -> CallbackFuture<'cx> + Send + Sync>>The callback for the connect stage.
helo: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString) -> CallbackFuture<'cx> + Send + Sync>>The callback for the helo stage.
mail: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, Vec<CString>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the mail stage.
rcpt: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, Vec<CString>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the rcpt stage.
data: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the data stage.
header: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString, CString) -> CallbackFuture<'cx> + Send + Sync>>The callback for the header stage.
eoh: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the eoh stage.
body: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, Bytes) -> CallbackFuture<'cx> + Send + Sync>>The callback for the body stage.
eom: Option<Box<dyn for<'cx> Fn(&'cx mut EomContext<T>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the eom stage.
abort: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the abort stage.
close: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>) -> CallbackFuture<'cx> + Send + Sync>>The callback for the close stage.
unknown: Option<Box<dyn for<'cx> Fn(&'cx mut Context<T>, CString) -> CallbackFuture<'cx> + Send + Sync>>The callback for the unknown stage.
Implementations§
Source§impl<T: Send> Callbacks<T>
impl<T: Send> Callbacks<T>
Sourcepub fn on_negotiate(
self,
callback: impl Fn(&mut NegotiateContext<T>, Actions, ProtoOpts) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_negotiate( self, callback: impl Fn(&mut NegotiateContext<T>, Actions, ProtoOpts) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the negotiate stage.
Sourcepub fn on_connect(
self,
callback: impl Fn(&mut Context<T>, CString, SocketInfo) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_connect( self, callback: impl Fn(&mut Context<T>, CString, SocketInfo) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the connect stage.
Sourcepub fn on_helo(
self,
callback: impl Fn(&mut Context<T>, CString) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_helo( self, callback: impl Fn(&mut Context<T>, CString) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the helo stage.
Sourcepub fn on_mail(
self,
callback: impl Fn(&mut Context<T>, Vec<CString>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_mail( self, callback: impl Fn(&mut Context<T>, Vec<CString>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the mail stage.
Sourcepub fn on_rcpt(
self,
callback: impl Fn(&mut Context<T>, Vec<CString>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_rcpt( self, callback: impl Fn(&mut Context<T>, Vec<CString>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the rcpt stage.
Sourcepub fn on_data(
self,
callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_data( self, callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the data stage.
Sourcepub fn on_header(
self,
callback: impl Fn(&mut Context<T>, CString, CString) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_header( self, callback: impl Fn(&mut Context<T>, CString, CString) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the header stage.
Sourcepub fn on_eoh(
self,
callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_eoh( self, callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the eoh stage.
Sourcepub fn on_body(
self,
callback: impl Fn(&mut Context<T>, Bytes) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_body( self, callback: impl Fn(&mut Context<T>, Bytes) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the body stage.
Sourcepub fn on_eom(
self,
callback: impl Fn(&mut EomContext<T>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_eom( self, callback: impl Fn(&mut EomContext<T>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the eom stage.
Sourcepub fn on_abort(
self,
callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_abort( self, callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the abort stage.
Sourcepub fn on_close(
self,
callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_close( self, callback: impl Fn(&mut Context<T>) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the close stage.
Sourcepub fn on_unknown(
self,
callback: impl Fn(&mut Context<T>, CString) -> CallbackFuture<'_> + Send + Sync + 'static,
) -> Self
pub fn on_unknown( self, callback: impl Fn(&mut Context<T>, CString) -> CallbackFuture<'_> + Send + Sync + 'static, ) -> Self
Configures the callback for the unknown stage.