Skip to main content

Connection

Struct Connection 

Source
pub struct Connection { /* private fields */ }

Implementations§

Source§

impl Connection

Source

pub fn new(config: Config) -> Result<Self, Error>

Source

pub fn state(&self) -> State

Source

pub fn capabilities(&self) -> &Capabilities

Source

pub fn output(&self) -> &[u8] ⓘ

Source

pub fn consume_output(&mut self, count: usize)

Source

pub fn poll_event(&mut self) -> Option<Event>

Source

pub fn connected(&mut self, now: Instant) -> Result<(), Error>

Source

pub fn tls_established(&mut self, now: Instant) -> Result<(), Error>

Source

pub fn receive(&mut self, bytes: &[u8], now: Instant) -> Result<(), Error>

Source

pub fn send( &mut self, token: u64, envelope: Envelope, message_id: String, content: &[u8], now: Instant, ) -> Result<(), Error>

Move the result’s inherent envelope/ID ownership into the core. content may be lettre’s formatted MIME bytes or another already-built message. For a message too large to hold twice in memory, use Self::start_send.

Source

pub fn start_send( &mut self, token: u64, envelope: Envelope, message_id: String, body: StreamBody, now: Instant, ) -> Result<(), Error>

Starts a message whose content is streamed instead of passed whole. MAIL/RCPT/DATA proceed as for Self::send; once the server accepts DATA the core emits Event::BodyReady, after which the host passes the content in any number of Self::send_chunk calls and then calls Self::finish_body. Line-ending normalization and dot-stuffing carry across chunk boundaries, so any split yields the bytes send would. The result is the same single Sent/Failed for token.

Source

pub fn can_send_body(&self) -> bool

Source

pub fn send_chunk(&mut self, chunk: &[u8], now: Instant) -> Result<(), Error>

Encodes one piece of a streamed message into output(). Drain output() between chunks to keep memory bounded by the chunk size. 8-bit bytes in a body not declared eight_bit cannot be retracted mid-DATA, so they fail the transaction and close the transport.

Source

pub fn finish_body(&mut self, now: Instant) -> Result<(), Error>

Ends a streamed message: terminates its last line if needed and writes the . terminator. The server’s reply settles the token.

Source

pub fn reset(&mut self, now: Instant) -> Result<(), Error>

Source

pub fn quit(&mut self, now: Instant) -> Result<(), Error>

Source

pub fn next_timeout(&self) -> Option<Instant>

Source

pub fn handle_timeout(&mut self, now: Instant)

Source

pub fn transport_lost(&mut self)

Source

pub fn close(&mut self)

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.