async_pop/response/
mod.rs1pub mod capability;
2pub mod list;
3mod parser;
4pub mod stat;
5pub mod types;
6pub mod uidl;
7
8use bytes::Bytes;
9use nom::IResult;
10
11use crate::command::Command;
12
13use self::{
14 capability::Capability, list::List, stat::Stat, types::message::Text, uidl::UidlResponse,
15};
16
17#[derive(Debug)]
18pub struct Status {
19 success: bool,
20}
21
22impl Status {
23 pub fn new(success: bool) -> Self {
24 Self { success }
25 }
26
27 pub fn success(&self) -> bool {
28 self.success
29 }
30}
31
32#[derive(Debug)]
33pub enum Response {
34 Stat(Stat),
35 List(List),
36 Bytes(Bytes),
37 Uidl(UidlResponse),
38 Capability(Vec<Capability>),
39 Message(Text),
40 #[cfg(feature = "sasl")]
41 Challenge(Text),
42 Err(Text),
43}
44
45impl Response {
46 pub fn from_bytes<'a>(input: &'a [u8], command: &Command) -> IResult<&'a [u8], Self> {
47 parser::parse(input, command)
48 }
49}