[][src]Trait mail_smtp::misc::Cmd

pub trait Cmd: 'static + Send {
    fn check_cmd_availability(
        &self,
        caps: Option<&EhloData>
    ) -> Result<(), MissingCapabilities>;
fn exec(
        self,
        io: Io
    ) -> Box<dyn Future<Item = (Io, Result<Response, LogicError>), Error = Error> + 'static + Send>; fn boxed(self) -> Box<dyn TypeErasableCmd + 'static + Send>
    where
        Self: 'static
, { ... } }

Trait implemented by any smtp command

While it is not object safe on itself using cmd.boxed() provides something very similar to trait object.

Required methods

fn check_cmd_availability(
    &self,
    caps: Option<&EhloData>
) -> Result<(), MissingCapabilities>

This method is used to verify if the command can be used for a given connection

fn exec(
    self,
    io: Io
) -> Box<dyn Future<Item = (Io, Result<Response, LogicError>), Error = Error> + 'static + Send>

Executes this command on the given connection

This method should not be called directly, instead it is called by Connection.send. Which calls this method with two addition:

  1. send does use check_cmd_availability, so exec should not do so as it's unnecessary
  2. send turns the Io instance the returned future resolves to back into a Connection instance
Loading content...

Provided methods

fn boxed(self) -> Box<dyn TypeErasableCmd + 'static + Send> where
    Self: 'static, 

Turns the command into a BoxedCmd

BoxedCmd isn't a trait object of Cmd but it's similar to it and implements Cmd. Use this if you would normally use a Cmd trait object. (e.g. to but a number of cmd's in a Vec)

Loading content...

Implementations on Foreign Types

impl Cmd for Ehlo[src]

impl Cmd for Verify[src]

impl Cmd for Noop[src]

impl Cmd for Help[src]

impl Cmd for Arc<Plain>[src]

impl<A, B> Cmd for EitherCmd<A, B> where
    A: Cmd,
    B: Cmd
[src]

impl Cmd for Reset[src]

impl Cmd for Box<dyn TypeErasableCmd + 'static + Send>[src]

impl<S> Cmd for Data<S> where
    S: 'static + Stream<Error = Error> + Send,
    <S as Stream>::Item: Buf
[src]

impl<A, B> Cmd for SelectCmd<A, B> where
    A: Cmd,
    B: Cmd
[src]

impl Cmd for Recipient[src]

impl<S> Cmd for StartTls<S> where
    S: SetupTls
[src]

impl Cmd for Mail[src]

Loading content...

Implementors

impl Cmd for Login[src]

impl Cmd for Plain[src]

Loading content...