use std::collections::HashSet;
#[derive(Clone)]
pub struct Mail {
pub sender: Vec<u8>,
pub recipients: HashSet<Vec<u8>>,
pub body: Vec<u8>,
}
impl Mail {
pub fn new(sender: Vec<u8>, recipients: HashSet<Vec<u8>>, mut body: Vec<u8>) -> Self {
if let Some(i) = body.windows(4).position(|window| window == b"\r\n\r\n") {
body.drain(0..=i + 3);
}
Self {
sender,
recipients,
body,
}
}
}