Struct Server

Source
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>

Source

pub fn new( milter: &'m mut M, quit_on_abort: bool, max_buffer_size: usize, ) -> Self

Create a new Server to handle connections

Source

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:

  1. 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.

Source

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§

Source§

impl<'m, M: Debug + Milter> Debug for Server<'m, M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.