imap_next/
types.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//! Types that extend `imap-types`.
// TODO: Do we really need this?

use std::borrow::Cow;

use imap_codec::imap_types::{
    auth::AuthMechanism,
    command::{Command, CommandBody},
    core::Tag,
    secret::Secret,
};

#[derive(Debug)]
pub struct CommandAuthenticate {
    pub tag: Tag<'static>,
    pub mechanism: AuthMechanism<'static>,
    pub initial_response: Option<Secret<Cow<'static, [u8]>>>,
}

impl From<CommandAuthenticate> for Command<'static> {
    fn from(command_authenticate: CommandAuthenticate) -> Self {
        Self {
            tag: command_authenticate.tag,
            body: CommandBody::Authenticate {
                mechanism: command_authenticate.mechanism,
                initial_response: command_authenticate.initial_response,
            },
        }
    }
}