1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Note that none of these fields are *actually* 'static.
// Rather, they are tied to the lifetime of the `ZeroCopy` that contains this `Name`.
#[derive(Debug, Eq, PartialEq)]
pub struct Fetch {
    pub message: u32,
    pub(crate) flags: Vec<&'static str>,
    pub uid: Option<u32>,
    pub(crate) rfc822_header: Option<&'static [u8]>,
    pub(crate) rfc822: Option<&'static [u8]>,
}

impl Fetch {
    pub fn flags<'a>(&'a self) -> &'a [&'a str] {
        &self.flags[..]
    }

    pub fn rfc822_header<'a>(&'a self) -> Option<&'a [u8]> {
        self.rfc822_header
    }

    pub fn rfc822<'a>(&'a self) -> Option<&'a [u8]> {
        self.rfc822
    }
}