use tokio::io::{AsyncRead, AsyncWrite};
use crate::client::MapClient;
use crate::{FolderListing, MapError};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Folder {
Inbox,
Sent,
Outbox,
Deleted,
}
impl Folder {
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::Inbox => "inbox",
Self::Sent => "sent",
Self::Outbox => "outbox",
Self::Deleted => "deleted",
}
}
}
impl<T: AsyncRead + AsyncWrite + Unpin> MapClient<T> {
pub async fn list_message_folders(&mut self) -> Result<FolderListing, MapError> {
self.reset_to_root().await?;
self.setpath("telecom").await?;
self.setpath("msg").await?;
self.get_folder_listing().await
}
}