[][src]Struct lettre::message::Body

pub struct Body { /* fields omitted */ }
This is supported on crate feature builder only.

A Message or SinglePart body that has already been encoded.

Implementations

impl Body[src]

pub fn new<B: Into<MaybeString>>(buf: B) -> Self[src]

Encode the supplied buf, making it ready to be sent as a body.

Takes a Vec<u8> or a String.

Automatically chooses the most efficient encoding between 7bit, quoted-printable and base64.

If buf is valid utf-8 a String should be supplied, as Strings can be encoded as 7bit or quoted-printable, while Vec<u8> always get encoded as base64.

pub fn new_with_encoding<B: Into<MaybeString>>(
    buf: B,
    encoding: ContentTransferEncoding
) -> Result<Self, Vec<u8>>
[src]

Encode the supplied buf, using the provided encoding.

Body::new is generally the better option.

Returns an Err giving back the supplied buf, in case the chosen encoding would have resulted into buf being encoded into an invalid body.

pub fn dangerous_pre_encoded(
    buf: Vec<u8>,
    encoding: ContentTransferEncoding
) -> Self
[src]

Builds a new Body using a pre-encoded buffer.

Generally not you want.

buf shouldn't contain non-ascii characters, lines longer than 1000 characters or nul bytes.

pub fn len(&self) -> usize[src]

Returns the length of this Body in bytes.

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

Returns true if this Body has a length of zero, false otherwise.

pub fn encoding(&self) -> ContentTransferEncoding[src]

Returns the Content-Transfer-Encoding of this Body.

pub fn into_vec(self) -> Vec<u8>[src]

Consumes Body and returns the inner Vec<u8>

Trait Implementations

impl AsRef<[u8]> for Body[src]

impl Clone for Body[src]

impl Debug for Body[src]

impl IntoBody for Body[src]

Auto Trait Implementations

Blanket Implementations

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

impl<A, T> AsBits<T> for A where
    T: BitStore + BitRegister,
    A: AsRef<[T]>, 

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

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

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

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

impl<T> Instrument for T[src]

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,