#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Fold<'x> {
pub width: usize,
pub separator: &'x [u8],
pub indent: usize,
pub granularity: usize,
}
impl<'x> Fold<'x> {
pub const DKIM: Fold<'static> = Fold {
width: 76,
separator: b"\r\n\t",
indent: 1,
granularity: 1,
};
pub const HEADER: Fold<'static> = Fold {
width: 76,
separator: b"\r\n ",
indent: 1,
granularity: 1,
};
pub const CONTENT_LINE: Fold<'static> = Fold {
width: 75,
separator: b"\r\n ",
indent: 1,
granularity: 1,
};
pub const fn new(width: usize, separator: &'x [u8], indent: usize) -> Self {
Fold {
width,
separator,
indent,
granularity: 1,
}
}
pub const fn with_granularity(mut self, granularity: usize) -> Self {
self.granularity = if granularity == 0 { 1 } else { granularity };
self
}
}