Struct new_tokio_smtp::io::Io
source · pub struct Io { /* private fields */ }
Expand description
A Io
object representing a smtp connection with buffers, socket and ehlo data
Implementations§
source§impl Io
impl Io
sourcepub fn flush(self) -> Flushing
pub fn flush(self) -> Flushing
return a futures resolving back to this instance once all output data is flushed
sourcepub fn flush_line_from_parts(self, line: &[&str]) -> Flushing
pub fn flush_line_from_parts(self, line: &[&str]) -> Flushing
writes cmd
and then "\r\n"
to buffer.input
and then calls flush
sourcepub fn poll_flush(&mut self) -> Poll<(), Error>
pub fn poll_flush(&mut self) -> Poll<(), Error>
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.
source§impl Io
impl Io
sourcepub fn parse_response(self) -> Parsing
pub fn parse_response(self) -> Parsing
sourcepub fn read_from_socket(&mut self) -> Result<ReadState, Error>
pub fn read_from_socket(&mut self) -> Result<ReadState, Error>
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
)
sourcepub fn try_pop_line<F, R, E>(&mut self, parse_line_fn: F) -> Result<Option<R>, E>where
F: FnOnce(&[u8]) -> Result<R, E>,
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>,
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
source§impl Io
impl Io
sourcepub fn write_dot_stashed<S>(self, source: S) -> DotStashedWrite<S>where
S: Stream<Error = Error>,
S::Item: Buf,
pub fn write_dot_stashed<S>(self, source: S) -> DotStashedWrite<S>where
S: Stream<Error = Error>,
S::Item: Buf,
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.
source§impl Io
impl Io
sourcepub fn connect_insecure(
addr: &SocketAddr
) -> Map<ConnectFuture, fn(_: TcpStream) -> Io>
pub fn connect_insecure(
addr: &SocketAddr
) -> Map<ConnectFuture, fn(_: TcpStream) -> Io>
create a new Tcp only connection to the given address
sourcepub fn connect_secure<S>(
addr: &SocketAddr,
config: TlsConfig<S>
) -> impl Future<Item = Io, Error = Error> + Sendwhere
S: SetupTls,
pub fn connect_secure<S>(
addr: &SocketAddr,
config: TlsConfig<S>
) -> impl Future<Item = Io, Error = Error> + Sendwhere
S: SetupTls,
create a new Tcp-Tls connection to the given address using the given tls config
source§impl Io
impl Io
sourcepub fn write_line_from_parts(&mut self, parts: &[&str])
pub fn write_line_from_parts(&mut self, parts: &[&str])
writes all strings in parts
to the output buffer followed by "\r\n"
sourcepub fn socket_mut(&mut self) -> &mut Socket ⓘ
pub fn socket_mut(&mut self) -> &mut Socket ⓘ
returns a &mut
to the inner Socket
abstraction
sourcepub fn is_secure(&self) -> bool
pub fn is_secure(&self) -> bool
true if the socket uses Tls
(can also be true in case of a mock socket)
sourcepub fn out_buffer(&mut self, need_rem: usize) -> &mut BytesMut
pub fn out_buffer(&mut self, need_rem: usize) -> &mut BytesMut
returns a &mut
to a (the) output buffer having at last need_rem
bytes free capacity
sourcepub fn set_ehlo_data(&mut self, data: EhloData)
pub fn set_ehlo_data(&mut self, data: EhloData)
store different helo data
sourcepub fn has_capability<C>(&self, cap: C) -> boolwhere
C: AsRef<str>,
pub fn has_capability<C>(&self, cap: C) -> boolwhere
C: AsRef<str>,
checks if a specific EsmtpKeyword
had been in the last
Ehlo response
sourcepub fn exec_simple_cmd(self, parts: &[&str]) -> ExecFuture
pub fn exec_simple_cmd(self, parts: &[&str]) -> ExecFuture
used to impl. simple commands e.g. con.send_simple_cmd(&["NOOP"])
Trait Implementations§
source§impl From<Connection> for Io
impl From<Connection> for Io
source§fn from(con: Connection) -> Self
fn from(con: Connection) -> Self
source§impl From<Io> for Connection
impl From<Io> for Connection
create a new Connection
from a Io
instance
The Io
instance should contain a Socket
which
is still alive.