Skip to main content

RenderOptions

Struct RenderOptions 

Source
#[non_exhaustive]
pub struct RenderOptions { pub include_bcc: bool, pub soft_fold_at: Option<usize>, }
Expand description

Render-time options for render_rfc822_with.

The struct is #[non_exhaustive]; future fields will be additive. Construct via Self::new or Self::default and chain with_* setters.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§include_bcc: bool

When true, the rendered message includes a Bcc: header line listing the message’s BCC recipients. Defaults to false.

Most SMTP relays strip Bcc: on submission anyway; rendering the field is occasionally useful for archival, .eml fixtures, or clients that consume the rendered bytes outside the SMTP path.

§soft_fold_at: Option<usize>

Optional soft-fold target for header lines, in characters.

None (the default) emits header lines at the RFC 5322 §2.1.1 hard limit of 998 characters with no soft folding, long values flow on a single physical line. Some(n) instructs the renderer to fold longer lines at n characters via the standard folding-whitespace mechanism (CRLF + leading SP/HTAB), targeting the SHOULD ≤ 78 recommendation when n == 78.

The default is None because correct soft folding requires per-header-grammar awareness (encoded-word boundaries, address-list comma discipline, structured-header whitespace rules) that the simple folding helper cannot guarantee in every case. Callers who want SHOULD-compliant output for archival or for strict legacy MTAs can opt in via with_soft_fold(78); the renderer still respects the 998 hard limit regardless.

Implementations§

Source§

impl RenderOptions

Source

pub const fn new() -> Self

Source

pub const fn with_include_bcc(self, value: bool) -> Self

Source

pub const fn with_soft_fold(self, soft_fold_at: usize) -> Self

Set the soft-fold target. Pass 78 for the RFC 5322 §2.1.1 SHOULD-compliant recommendation; pass any other positive integer up to 997 for a custom target.

Source

pub const fn without_soft_fold(self) -> Self

Disable soft folding. Long header values flow on one physical line up to the 998-character hard limit.

Trait Implementations§

Source§

impl Clone for RenderOptions

Source§

fn clone(&self) -> RenderOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RenderOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RenderOptions

Source§

fn default() -> RenderOptions

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RenderOptions

Source§

fn eq(&self, other: &RenderOptions) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for RenderOptions

Source§

impl Eq for RenderOptions

Source§

impl StructuralPartialEq for RenderOptions

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.