more shifting

This commit is contained in:
Michael Zhang 2021-08-09 18:02:26 -05:00
parent 60e0bb3bbb
commit bbc64fde3b
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
11 changed files with 22 additions and 16 deletions

3
Cargo.lock generated
View file

@ -664,7 +664,6 @@ dependencies = [
"anyhow",
"async-trait",
"bitflags",
"bstr",
"bytes",
"chrono",
"derive_builder",
@ -685,8 +684,10 @@ name = "panorama-proto-common"
version = "0.0.1"
dependencies = [
"anyhow",
"bstr",
"bytes",
"format-bytes",
"log",
"nom",
]

View file

@ -23,7 +23,6 @@ rfc6154 = [] # list
anyhow = "1.0.42"
async-trait = "0.1.51"
bitflags = "1.2.1"
bstr = "0.2.15"
bytes = "1.0.1"
chrono = "0.4.19"
derive_builder = "0.10.2"

View file

@ -2,12 +2,11 @@ use std::io::{self};
use bytes::{BufMut, BytesMut};
use nom::Needed;
use panorama_proto_common::Bytes;
use panorama_proto_common::{convert_error, Bytes};
use tokio_util::codec::{Decoder, Encoder};
use crate::proto::{
command::Command,
convert_error::convert_error,
response::{Response, Tag},
rfc3501::response as parse_response,
};

View file

@ -2,11 +2,6 @@
#![allow(non_snake_case, dead_code)]
// utils
#[macro_use]
mod macros;
pub mod convert_error;
// data types
pub mod command;
pub mod response;

View file

@ -166,4 +166,4 @@ pub enum MailboxListFlag {
Marked,
Unmarked,
Extension(Atom),
}
}

View file

@ -26,10 +26,10 @@ fn test_list() {
flags,
delimiter: Some(b'.'),
mailbox: Mailbox::Name(mailbox),
}) ) if flags.len() == 3 &&
flags.contains(&MailboxListFlag::Extension(Atom::from(b"HasChildren"))) &&
flags.contains(&MailboxListFlag::Extension(Atom::from(b"UnMarked"))) &&
flags.contains(&MailboxListFlag::Extension(Atom::from(b"Trash"))) &&
}) ) if flags.len() == 3 &&
flags.contains(&MailboxListFlag::Extension(Atom::from(b"HasChildren"))) &&
flags.contains(&MailboxListFlag::Extension(Atom::from(b"UnMarked"))) &&
flags.contains(&MailboxListFlag::Extension(Atom::from(b"Trash"))) &&
&*mailbox == &b"Trash"[..]
));
}

View file

@ -10,6 +10,8 @@ workspace = ".."
[dependencies]
anyhow = "1.0.42"
bstr = "0.2.15"
bytes = "1.0.1"
format-bytes = "0.2.2"
nom = "6.2.1"
log = "0.4.14"
nom = "6.2.1"

View file

@ -1,10 +1,15 @@
#[macro_use]
extern crate anyhow;
#[macro_use]
extern crate log;
mod bytes;
mod convert_error;
mod formatter;
mod parsers;
mod rule;
pub use crate::bytes::{Bytes, ShitCompare, ShitNeededForParsing};
pub use crate::convert_error::convert_error;
pub use crate::formatter::quote_string;
pub use crate::parsers::{byte, never, parse_u32, satisfy, skip, tagi, take, take_while1, VResult};

View file

@ -1,3 +1,7 @@
use crate::{Bytes, VResult};
/// Defines a new parser rule that operates on [`Bytes`] and produces a [`VResult`].
#[macro_export]
macro_rules! rule {
($vis:vis $name:ident : $ret:ty => $expr:expr) => {
$vis fn $name (

View file

@ -1,4 +1,5 @@
//! SMTP Specification
//! ---
//!
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc5321>
//! Grammar from <https://datatracker.ietf.org/doc/html/rfc5321>