Skip to content

Commit

Permalink
refactor: re-export imap-types
Browse files Browse the repository at this point in the history
  • Loading branch information
duesee committed Jul 12, 2024
1 parent d6b6c81 commit 9e0098e
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 77 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ stream = ["dep:bytes", "dep:rustls", "dep:tokio", "dep:tokio-rustls"]
[dependencies]
bytes = { version = "1.6.0", optional = true }
imap-codec = { version = "2.0.0-alpha.1", features = ["starttls", "quirk_crlf_relaxed", "ext_condstore_qresync", "ext_login_referrals", "ext_mailbox_referrals", "ext_id", "ext_sort_thread", "ext_binary", "ext_metadata", "ext_uidplus"], git = "https://github.com/duesee/imap-codec", rev = "6bd83aff18fc12bad2b45c9fc50506b0c26ae2f6" }
imap-types = { version = "2.0.0-alpha.1", features = ["starttls", "ext_condstore_qresync", "ext_login_referrals", "ext_mailbox_referrals", "ext_id", "ext_sort_thread", "ext_binary", "ext_metadata", "ext_uidplus"], git = "https://github.com/duesee/imap-codec", rev = "6bd83aff18fc12bad2b45c9fc50506b0c26ae2f6" }
rustls = { version = "0.23.11", optional = true }
thiserror = "1.0.61"
tokio = { version = "1.38.0", optional = true, features = ["io-util", "macros", "net"] }
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ And it's sans I/O enabling the integration in any existing I/O runtime.
use std::error::Error;
use imap_next::{
client::{Client, Event, Options},
imap_types::{
command::{Command, CommandBody},
core::Tag,
},
stream::Stream,
};
use imap_types::{
command::{Command, CommandBody},
core::Tag,
};
use tokio::net::TcpStream;
#[tokio::main]
Expand Down
8 changes: 4 additions & 4 deletions examples/client.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use imap_next::{
client::{Client, Event, Options},
imap_types::{
command::{Command, CommandBody},
core::Tag,
},
stream::Stream,
};
use imap_types::{
command::{Command, CommandBody},
core::Tag,
};
use tokio::net::TcpStream;

#[tokio::main(flavor = "current_thread")]
Expand Down
8 changes: 4 additions & 4 deletions examples/client_authenticate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use std::collections::VecDeque;

use imap_next::{
client::{Client, Event, Options},
imap_types::{
auth::{AuthMechanism, AuthenticateData},
command::{Command, CommandBody},
},
stream::Stream,
};
use imap_types::{
auth::{AuthMechanism, AuthenticateData},
command::{Command, CommandBody},
};
use tag_generator::TagGenerator;
use tokio::net::TcpStream;

Expand Down
10 changes: 5 additions & 5 deletions examples/client_idle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use std::io::BufRead;

use imap_next::{
client::{Client, Event, Options},
imap_types::{
command::{Command, CommandBody},
core::Tag,
response::{Status, Tagged},
},
stream::Stream,
};
use imap_types::{
command::{Command, CommandBody},
core::Tag,
response::{Status, Tagged},
};
use tokio::{net::TcpStream, sync::mpsc::Receiver};

#[tokio::main(flavor = "current_thread")]
Expand Down
8 changes: 4 additions & 4 deletions examples/client_std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::{

use imap_next::{
client::{Client, Event, Options},
imap_types::{
command::{Command, CommandBody},
core::Tag,
},
Interrupt, Io, State,
};
use imap_types::{
command::{Command, CommandBody},
core::Tag,
};

fn main() {
let mut stream = TcpStream::connect("127.0.0.1:12345").unwrap();
Expand Down
2 changes: 1 addition & 1 deletion examples/server.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::collections::VecDeque;

use imap_next::{
imap_types::response::{Greeting, Status},
server::{Event, Options, Server},
stream::Stream,
};
use imap_types::response::{Greeting, Status};
use tokio::net::TcpListener;

#[tokio::main(flavor = "current_thread")]
Expand Down
2 changes: 1 addition & 1 deletion examples/server_authenticate.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use imap_next::{
imap_types::response::{CommandContinuationRequest, Greeting, Status},
server::{Event, Options, Server},
stream::Stream,
types::CommandAuthenticate,
};
use imap_types::response::{CommandContinuationRequest, Greeting, Status};
use tokio::net::TcpListener;

#[tokio::main(flavor = "current_thread")]
Expand Down
6 changes: 4 additions & 2 deletions examples/server_fragmentizer.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::{io::Read, net::TcpListener};

use imap_codec::{AuthenticateDataCodec, CommandCodec, IdleDoneCodec};
use imap_next::fragmentizer::{Fragmentizer, MaxMessageSize};
use imap_types::command::CommandBody;
use imap_next::{
fragmentizer::{Fragmentizer, MaxMessageSize},
imap_types::command::CommandBody,
};

enum State {
Command,
Expand Down
12 changes: 6 additions & 6 deletions examples/server_idle.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use std::{io::BufRead, num::NonZeroU32};

use imap_next::{
imap_types::{
core::Text,
response::{
CommandContinuationRequest, Data, Greeting, Status, StatusBody, StatusKind, Tagged,
},
},
server::{Event, Options, Server},
stream::Stream,
};
use imap_types::{
core::Text,
response::{
CommandContinuationRequest, Data, Greeting, Status, StatusBody, StatusKind, Tagged,
},
};
use tokio::{net::TcpListener, sync::mpsc::Receiver};

#[tokio::main(flavor = "current_thread")]
Expand Down
14 changes: 7 additions & 7 deletions src/client.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::fmt::{Debug, Formatter};

use imap_codec::{
imap_types::{
auth::AuthenticateData,
command::Command,
response::{CommandContinuationRequest, Data, Greeting, Response, Status},
secret::Secret,
},
AuthenticateDataCodec, CommandCodec, GreetingCodec, IdleDoneCodec, ResponseCodec,
};
use imap_types::{
auth::AuthenticateData,
command::Command,
response::{CommandContinuationRequest, Data, Greeting, Response, Status},
secret::Secret,
};
use thiserror::Error;

use crate::{
Expand Down Expand Up @@ -299,7 +299,7 @@ pub enum Event {
///
/// Note: [`Client`] already handled this [`Status`] but it might still have
/// useful information that could be logged or displayed to the user
/// (e.g. [`Code::Alert`](imap_types::response::Code::Alert)).
/// (e.g. [`Code::Alert`](crate::imap_types::response::Code::Alert)).
status: Status<'static>,
},
/// AUTHENTICATE sent.
Expand Down
14 changes: 7 additions & 7 deletions src/client_send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ use std::{collections::VecDeque, convert::Infallible};

use imap_codec::{
encode::{Encoder, Fragment},
imap_types::{
auth::AuthenticateData,
command::{Command, CommandBody},
core::{LiteralMode, Tag},
extensions::idle::IdleDone,
response::{Status, StatusBody, StatusKind, Tagged},
},
AuthenticateDataCodec, CommandCodec, IdleDoneCodec,
};
use imap_types::{
auth::AuthenticateData,
command::{Command, CommandBody},
core::{LiteralMode, Tag},
extensions::idle::IdleDone,
response::{Status, StatusBody, StatusKind, Tagged},
};
use tracing::warn;

use crate::{client::CommandHandle, types::CommandAuthenticate, Interrupt, Io};
Expand Down
23 changes: 14 additions & 9 deletions src/fragmentizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
use std::{collections::VecDeque, ops::Range};

use imap_codec::decode::Decoder;
use imap_types::{
core::{LiteralMode, Tag},
secret::Secret,
use imap_codec::{
decode::Decoder,
imap_types::{
core::{LiteralMode, Tag},
secret::Secret,
},
};

/// Limits the size of messages that can be decoded by [`Fragmentizer`].
Expand Down Expand Up @@ -548,11 +550,14 @@ mod tests {
use core::panic;
use std::collections::VecDeque;

use imap_codec::{decode::ResponseDecodeError, CommandCodec, ResponseCodec};
use imap_types::{
command::{Command, CommandBody},
core::{LiteralMode, Tag},
secret::Secret,
use imap_codec::{
decode::ResponseDecodeError,
imap_types::{
command::{Command, CommandBody},
core::{LiteralMode, Tag},
secret::Secret,
},
CommandCodec, ResponseCodec,
};

use super::{
Expand Down
12 changes: 7 additions & 5 deletions src/receive.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use imap_codec::decode::Decoder;
use imap_types::{
core::{LiteralMode, Tag},
secret::Secret,
IntoStatic,
use imap_codec::{
decode::Decoder,
imap_types::{
core::{LiteralMode, Tag},
secret::Secret,
IntoStatic,
},
};

use crate::{
Expand Down
24 changes: 12 additions & 12 deletions src/server.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use std::fmt::{Debug, Formatter};

use imap_codec::{
AuthenticateDataCodec, CommandCodec, GreetingCodec, IdleDoneCodec, ResponseCodec,
};
use imap_types::{
auth::AuthenticateData,
command::{Command, CommandBody},
core::{LiteralMode, Tag, Text},
extensions::idle::IdleDone,
response::{
CommandContinuationRequest, CommandContinuationRequestBasic, Data, Greeting, Response,
Status,
imap_types::{
auth::AuthenticateData,
command::{Command, CommandBody},
core::{LiteralMode, Tag, Text},
extensions::idle::IdleDone,
response::{
CommandContinuationRequest, CommandContinuationRequestBasic, Data, Greeting, Response,
Status,
},
secret::Secret,
ToStatic,
},
secret::Secret,
ToStatic,
AuthenticateDataCodec, CommandCodec, GreetingCodec, IdleDoneCodec, ResponseCodec,
};
use thiserror::Error;

Expand Down
2 changes: 1 addition & 1 deletion src/server_send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::{collections::VecDeque, convert::Infallible};

use imap_codec::{
encode::{Encoded, Encoder, Fragment},
imap_types::response::{Greeting, Response},
GreetingCodec, ResponseCodec,
};
use imap_types::response::{Greeting, Response};

use crate::{server::ResponseHandle, Interrupt, Io};

Expand Down
2 changes: 1 addition & 1 deletion src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use bytes::{Buf, BufMut, BytesMut};
#[cfg(debug_assertions)]
use imap_types::utils::escape_byte_string;
use imap_codec::imap_types::utils::escape_byte_string;
use thiserror::Error;
use tokio::{
io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt},
Expand Down
2 changes: 1 addition & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use imap_types::{
use imap_codec::imap_types::{
auth::AuthMechanism,
command::{Command, CommandBody},
core::Tag,
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use std::borrow::Cow;

use imap_types::{
use imap_codec::imap_types::{
auth::AuthMechanism,
command::{Command, CommandBody},
core::Tag,
Expand Down

0 comments on commit 9e0098e

Please sign in to comment.