[][src]Struct new_tokio_smtp::io::Io

pub struct Io { /* fields omitted */ }

A Io object representing a smtp connection with buffers, socket and ehlo data

Implementations

impl Io[src]

pub fn flush(self) -> Flushing[src]

return a futures resolving back to this instance once all output data is flushed

pub fn flush_line_from_parts(self, line: &[&str]) -> Flushing[src]

writes cmd and then "\r\n" to buffer.input and then calls flush

pub fn poll_flush(&mut self) -> Poll<(), Error>[src]

writes data from the output buffer to the socket and polls flush

This first poll the writing of data from output to socket until output is empty, then it will start polling flush on the socket.

impl Io[src]

pub fn parse_response(self) -> Parsing[src]

parse a "normal" smtp response

Panics

Panics if the write buffer is not empty

pub fn read_from_socket(&mut self) -> Result<ReadState, Error>[src]

read data from the socket to buffer.input until it would block or the socket closed

The input buffer is increased in increments of 256 bytes (INPUT_BUFFER_INC_SIZE)

pub fn try_pop_line<F, R, E>(
    &mut self,
    parse_line_fn: F
) -> Result<Option<R>, E> where
    F: FnOnce(&[u8]) -> Result<R, E>, 
[src]

Implementation Limitations

Be aware that try_read_line does only work on continuous buffers. I.e. it would fail if self.in_buffer() is a Chain

impl Io[src]

pub fn write_dot_stashed<S>(self, source: S) -> DotStashedWrite<S> where
    S: Stream<Error = Error>,
    S::Item: Buf
[src]

write all data from source to the output socket using dot-stashing

This includes the end of message sequence "\r\n.\r\n", through this implementation makes sure not to add a additional "\r\n" to the end of the file if it isn't needed.

impl Io[src]

pub fn connect_insecure(
    addr: &SocketAddr
) -> Map<ConnectFuture, fn(_: TcpStream) -> Io>
[src]

create a new Tcp only connection to the given address

pub fn connect_secure<S>(
    addr: &SocketAddr,
    config: TlsConfig<S>
) -> impl Future<Item = Io, Error = Error> + Send where
    S: SetupTls
[src]

create a new Tcp-Tls connection to the given address using the given tls config

impl Io[src]

pub fn split(self) -> (Socket, Buffers, Option<EhloData>)[src]

split this instance into it's parts

pub fn write_line_from_parts(&mut self, parts: &[&str])[src]

writes all strings in parts to the output buffer followed by "\r\n"

pub fn socket_mut(&mut self) -> &mut Socket[src]

returns a &mut to the inner Socket abstraction

pub fn socket(&self) -> &Socket[src]

returns a & to the inner Socket abstraction

pub fn is_secure(&self) -> bool[src]

true if the socket uses Tls

(can also be true in case of a mock socket)

pub fn out_buffer(&mut self, need_rem: usize) -> &mut BytesMut[src]

returns a &mut to a (the) output buffer having at last need_rem bytes free capacity

pub fn in_buffer(&mut self) -> &mut BytesMut[src]

returns a &mut to the input buffer

pub fn ehlo_data(&self) -> Option<&EhloData>[src]

access the stored ehlo data

pub fn set_ehlo_data(&mut self, data: EhloData)[src]

store different helo data

pub fn has_capability<C>(&self, cap: C) -> bool where
    C: AsRef<str>, 
[src]

checks if a specific EsmtpKeyword had been in the last Ehlo response

pub fn exec_simple_cmd(self, parts: &[&str]) -> ExecFuture[src]

used to impl. simple commands e.g. con.send_simple_cmd(&["NOOP"])

Trait Implementations

impl Debug for Io[src]

impl From<(Socket, Buffers, EhloData)> for Io[src]

impl From<(Socket, Buffers, Option<EhloData>)> for Io[src]

impl From<(Socket, Buffers)> for Io[src]

impl From<Connection> for Io[src]

impl From<Io> for Connection[src]

create a new Connection from a Io instance

The Io instance should contain a Socket which is still alive.

impl From<Socket> for Io[src]

impl From<TcpStream> for Io[src]

impl From<TlsStream<TcpStream>> for Io[src]

Auto Trait Implementations

impl !RefUnwindSafe for Io

impl Send for Io

impl Sync for Io

impl Unpin for Io

impl !UnwindSafe for Io

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.