Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: re-export imap-types #244

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions 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
1 change: 0 additions & 1 deletion integration-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ bstr = { version = "1.9.1", default-features = false }
bytes = "1.6.0"
imap-codec = { version = "2.0.0-alpha.1", git = "https://github.com/duesee/imap-codec", rev = "6bd83aff18fc12bad2b45c9fc50506b0c26ae2f6" }
imap-next = { path = ".." }
imap-types = { version = "2.0.0-alpha.1", git = "https://github.com/duesee/imap-codec", rev = "6bd83aff18fc12bad2b45c9fc50506b0c26ae2f6" }
tokio = { version = "1.38.0", features = ["macros", "net", "rt", "time"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/client_tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::net::SocketAddr;
use bstr::ByteSlice;
use imap_next::{
client::{self, Client, CommandHandle},
imap_types::{command::Command, ToStatic},
stream::{self, Stream},
};
use imap_types::{command::Command, ToStatic};
use tokio::net::TcpStream;
use tracing::trace;

Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/codecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use imap_codec::{
decode::Decoder, encode::Encoder, AuthenticateDataCodec, CommandCodec, GreetingCodec,
ResponseCodec,
};
use imap_types::{
use imap_next::imap_types::{
auth::AuthenticateData,
command::Command,
response::{CommandContinuationRequest, Data, Greeting, Response, Status},
Expand Down
2 changes: 1 addition & 1 deletion integration-test/src/server_tester.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use bstr::ByteSlice;
use imap_next::{
imap_types::{response::Response, ToStatic},
server::{self, ResponseHandle, Server},
stream::{self, Stream},
};
use imap_types::{response::Response, ToStatic};
use tokio::net::TcpListener;
use tracing::trace;

Expand Down
1 change: 0 additions & 1 deletion proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ argh = "0.1.12"
colored = "2.1.0"
imap-codec = { version = "2.0.0-alpha.1", features = ["quirk_crlf_relaxed", "ext_id"], git = "https://github.com/duesee/imap-codec", rev = "6bd83aff18fc12bad2b45c9fc50506b0c26ae2f6" }
imap-next = { path = ".." }
imap-types = { version = "2.0.0-alpha.1", features = ["ext_id"], git = "https://github.com/duesee/imap-codec", rev = "6bd83aff18fc12bad2b45c9fc50506b0c26ae2f6" }
once_cell = "1.19.0"
rustls-native-certs = "0.7.1"
rustls-pemfile = "2.1.2"
Expand Down
12 changes: 6 additions & 6 deletions proxy/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use std::{net::SocketAddr, sync::Arc};
use colored::Colorize;
use imap_next::{
client::{self, Client},
imap_types::{
command::{Command, CommandBody},
extensions::idle::IdleDone,
response::{Code, Status},
ToStatic,
},
server::{self, Server},
stream::{self, Stream},
};
use imap_types::{
command::{Command, CommandBody},
extensions::idle::IdleDone,
response::{Code, Status},
ToStatic,
};
use once_cell::sync::Lazy;
use thiserror::Error;
use tokio::net::{TcpListener, TcpStream};
Expand Down
2 changes: 1 addition & 1 deletion proxy/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{fs::File, io::BufReader, path::Path};

use imap_types::{
use imap_next::imap_types::{
auth::AuthMechanism,
core::Vec1,
response::{
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
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pub mod stream;
mod tests;
pub mod types;

// Re-export(s)
pub use imap_codec::imap_types;

// Test examples from imap-next's README.
#[doc = include_str!("../README.md")]
#[cfg(doctest)]
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
Loading
Loading