mail_builder/headers/
raw.rs1use super::{
8 Header,
9 fold::{FoldWriter, write_unstructured},
10};
11use crate::writer::Writer;
12use std::borrow::Cow;
13
14#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
17pub struct Raw<'x> {
18 pub raw: Cow<'x, str>,
19}
20
21impl<'x> Raw<'x> {
22 pub fn new(raw: impl Into<Cow<'x, str>>) -> Self {
24 Self { raw: raw.into() }
25 }
26}
27
28impl<'x, T> From<T> for Raw<'x>
29where
30 T: Into<Cow<'x, str>>,
31{
32 fn from(value: T) -> Self {
33 Self::new(value)
34 }
35}
36
37impl Header for Raw<'_> {
38 fn write_header(&self, output: &mut impl Writer, column: usize) {
39 let mut folder = FoldWriter::new(output, column);
40 write_unstructured(&mut folder, self.raw.as_bytes());
41 folder.finish();
42 }
43}