async_pop/response/
capability.rs

1use bytes::Bytes;
2
3use super::types::{message::Text, number::Duration};
4
5#[derive(Eq, PartialEq, PartialOrd, Ord, Debug, Hash, Clone)]
6pub enum Expiration {
7    Never,
8    Time(Duration),
9}
10
11impl Default for Expiration {
12    fn default() -> Self {
13        Self::Never
14    }
15}
16
17#[derive(Eq, PartialEq, PartialOrd, Ord, Debug, Hash, Clone)]
18pub enum Capability {
19    /// Whether the TOP command is supported.
20    Top,
21    /// Whether the USER and PASS commands (login) are supported.
22    User,
23    /// Whether the use of a SASL based login is supported and if so what kinds. See https://www.rfc-editor.org/rfc/rfc1734
24    Sasl(Vec<Bytes>),
25    /// Whether the server uses extends response codes. See https://www.rfc-editor.org/rfc/rfc2449#section-8
26    RespCodes,
27    /// Whether there is a delay between each login and how long it is.
28    LoginDelay(Duration),
29    /// Whether the server supports pipelining. See https://www.rfc-editor.org/rfc/rfc2197
30    Pipelining,
31    /// The amount of time the server will store messsages for.
32    Expire(Expiration),
33    /// Whether the UIDL command is supported.
34    Uidl,
35    /// The type of authentication method the server prefers/uses.
36    Implementation(Text),
37    Stls,
38    Other(Text),
39}
40
41pub type Capabilities = Vec<Capability>;