pub struct Server<'m, M: Milter> { /* private fields */ }
Expand description
The entry point to host a milter server
Implementations§
Source§impl<'m, M: Milter> Server<'m, M>
impl<'m, M: Milter> Server<'m, M>
Sourcepub fn new(
milter: &'m mut M,
quit_on_abort: bool,
max_buffer_size: usize,
) -> Self
pub fn new( milter: &'m mut M, quit_on_abort: bool, max_buffer_size: usize, ) -> Self
Create a new Server to handle connections
Sourcepub fn default_postfix(milter: &'m mut M) -> Self
pub fn default_postfix(milter: &'m mut M) -> Self
Create a server with defaults working with postfix.
The main difference is treating the call to abort
like a call to
quit
. See this comment as a source in the postfix docs
AFAIK, originally there where three use cases individual methods:
- Abort
The current smtp client that is connected to the milter client has finished. Next mail arrives. 2. Quit
The current smtp client that was connected to the milter client has quit it’s connection and the milter client will now quit this connection. 3. Quit NC
The current smtp client that was connected to the milter client has quit it’s connection but the milter client would like to re-use this connection for someone else.
Different implementation mix them up, making e.g. postfix just always opening up a new connection for every milter conversation.
Sourcepub async fn handle_connection<RW: AsyncRead + AsyncWrite + Unpin + Send>(
&mut self,
socket: RW,
) -> Result<(), Error<M::Error>>
pub async fn handle_connection<RW: AsyncRead + AsyncWrite + Unpin + Send>( &mut self, socket: RW, ) -> Result<(), Error<M::Error>>
Handle a single milter connection.
§Arguments
- milter: the object implementing
crate::Milter
. It’s methods will be called at the appropriate times.
§Errors
This basically errors for three cases: Io Problems, Codec Problems and problems returned by the milter implementation.
Have a look at crate::Error
for more information.
Trait Implementations§
Auto Trait Implementations§
impl<'m, M> Freeze for Server<'m, M>
impl<'m, M> RefUnwindSafe for Server<'m, M>where
M: RefUnwindSafe,
impl<'m, M> Send for Server<'m, M>
impl<'m, M> Sync for Server<'m, M>where
M: Sync,
impl<'m, M> Unpin for Server<'m, M>
impl<'m, M> !UnwindSafe for Server<'m, M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more