imap-types 1.0.0

Misuse-resistant data structures for IMAP
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use imap_types::{
    command::{Command, CommandBody},
    core::{Tag, Text},
    response::{Response, Status},
};

fn main() {
    let cmd = Command::new("A1", CommandBody::login("Alice", "Pa²²word").unwrap()).unwrap();
    println!("{:?}\n{}", cmd, serde_json::to_string_pretty(&cmd).unwrap());

    let rsp = Response::Status(Status::Ok {
        tag: Some(Tag::try_from("A1").unwrap()),
        code: None,
        text: Text::try_from("...").unwrap(),
    });

    println!("{:?}\n{}", rsp, serde_json::to_string_pretty(&rsp).unwrap());
}