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