33 lines
642 B
Rust
33 lines
642 B
Rust
use imap_codec::types::response::Data as ImapData;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Body {
|
|
Once(Vec<ImapData>),
|
|
}
|
|
|
|
impl Body {
|
|
pub(crate) fn into_data(self) -> Vec<ImapData> {
|
|
match self {
|
|
Body::Once(data) => data,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl FromIterator<ImapData> for Body {
|
|
fn from_iter<T: IntoIterator<Item = ImapData>>(iter: T) -> Self {
|
|
Body::Once(Vec::from_iter(iter))
|
|
}
|
|
}
|
|
|
|
impl From<Vec<ImapData>> for Body {
|
|
fn from(data: Vec<ImapData>) -> Self {
|
|
Body::from_iter(data)
|
|
}
|
|
}
|
|
|
|
impl From<ImapData> for Body {
|
|
fn from(data: ImapData) -> Self {
|
|
Body::from_iter([data])
|
|
}
|
|
}
|