Commit
+29 -24 +/-6 browse
1 | diff --git a/cmd/maitred-debug/src/main.rs b/cmd/maitred-debug/src/main.rs |
2 | index 933b52c..6422912 100644 |
3 | --- a/cmd/maitred-debug/src/main.rs |
4 | +++ b/cmd/maitred-debug/src/main.rs |
5 | @@ -7,10 +7,11 @@ use tracing::Level; |
6 | |
7 | mod config; |
8 | |
9 | - use maitred::{ |
10 | - mail_parser::Message, Delivery, DeliveryError, DeliveryFunc, Envelope, Maildir, MilterFunc, |
11 | - PlainAuthFunc, Server, SessionOptions, |
12 | - }; |
13 | + use maitred::auth::PlainAuthFunc; |
14 | + use maitred::delivery::{Delivery, DeliveryError, DeliveryFunc, Maildir}; |
15 | + use maitred::mail_parser::Message; |
16 | + use maitred::milter::MilterFunc; |
17 | + use maitred::{Envelope, Server, SessionOptions}; |
18 | |
19 | async fn print_message(envelope: &Envelope) -> Result<(), DeliveryError> { |
20 | println!( |
21 | diff --git a/maitred/src/delivery.rs b/maitred/src/delivery.rs |
22 | index 56a4274..510b478 100644 |
23 | --- a/maitred/src/delivery.rs |
24 | +++ b/maitred/src/delivery.rs |
25 | @@ -24,7 +24,8 @@ pub trait Delivery: Sync + Send { |
26 | |
27 | /// DeliveryFunc wraps an async closure implementing the Delivery trait. |
28 | /// ```rust |
29 | - /// use maitred::{DeliveryFunc, Envelope}; |
30 | + /// use maitred::delivery::DeliveryFunc; |
31 | + /// use maitred::Envelope; |
32 | /// |
33 | /// let delivery = DeliveryFunc(|message: &Envelope| { |
34 | /// async move { |
35 | diff --git a/maitred/src/expand.rs b/maitred/src/expand.rs |
36 | index 788b0a0..5be33e2 100644 |
37 | --- a/maitred/src/expand.rs |
38 | +++ b/maitred/src/expand.rs |
39 | @@ -28,7 +28,7 @@ pub trait Expansion { |
40 | /// # Example |
41 | /// ```rust |
42 | /// use email_address::EmailAddress; |
43 | - /// use maitred::ExpansionFunc; |
44 | + /// use maitred::expand::ExpansionFunc; |
45 | /// |
46 | /// let my_expn_fn = ExpansionFunc(|name: &str| { |
47 | /// async move { |
48 | diff --git a/maitred/src/lib.rs b/maitred/src/lib.rs |
49 | index 7961e09..b28dd50 100644 |
50 | --- a/maitred/src/lib.rs |
51 | +++ b/maitred/src/lib.rs |
52 | @@ -2,10 +2,13 @@ |
53 | //! within a Rust program. |
54 | //! # Example SMTP Server |
55 | //! ```rust |
56 | - //! use maitred::{ |
57 | - //! mail_parser::Message, Envelope, DeliveryError, DeliveryFunc, MilterFunc, Error, |
58 | - //! Milter, Server, SessionOptions, |
59 | - //! }; |
60 | + //! use maitred::auth::PlainAuthFunc; |
61 | + //! use maitred::delivery::{Delivery, DeliveryError, DeliveryFunc, Maildir}; |
62 | + //! use maitred::Error; |
63 | + //! use maitred::mail_parser::Message; |
64 | + //! use maitred::milter::MilterFunc; |
65 | + //! use maitred::{Envelope, Server, SessionOptions}; |
66 | + //! |
67 | //! use tracing::Level; |
68 | //! |
69 | //! async fn print_message(envelope: &Envelope) -> Result<(), DeliveryError> { |
70 | @@ -14,7 +17,7 @@ |
71 | //! println!("Subject: {:?}", envelope.body.subject()); |
72 | //! println!( |
73 | //! "{}", |
74 | - //! envelope.body |
75 | + //! envelope.body |
76 | //! .body_text(0) |
77 | //! .map(|text| String::from_utf8_lossy(text.as_bytes()).to_string()) |
78 | //! .unwrap_or_default() |
79 | @@ -47,17 +50,23 @@ |
80 | //! } |
81 | //! ``` |
82 | |
83 | + pub use email_address; |
84 | + pub use mail_parser; |
85 | + pub use smtp_proto; |
86 | + |
87 | + mod error; |
88 | + |
89 | + /// SMTP Authentication |
90 | pub mod auth; |
91 | + /// Message Delivery |
92 | pub mod delivery; |
93 | + /// Callback for implementing SMTP command EXPN |
94 | pub mod expand; |
95 | + /// Message and envelope manipulation |
96 | pub mod milter; |
97 | + /// Callback for implementing SMPT command VRFY |
98 | pub mod verify; |
99 | |
100 | - pub use email_address; |
101 | - pub use mail_parser; |
102 | - pub use smtp_proto; |
103 | - |
104 | - mod error; |
105 | mod rewrite; |
106 | mod server; |
107 | mod session; |
108 | @@ -68,12 +77,6 @@ mod worker; |
109 | use smtp_proto::Response as SmtpResponse; |
110 | use transport::Response; |
111 | |
112 | - pub use auth::{AuthError, PlainAuth, PlainAuthFunc}; |
113 | - pub use delivery::{Delivery, DeliveryError, DeliveryFunc, Maildir}; |
114 | - pub use expand::{Expansion, ExpansionError, ExpansionFunc}; |
115 | - pub use milter::{Milter, MilterError, MilterFunc}; |
116 | - pub use verify::{Verify, VerifyError, VerifyFunc}; |
117 | - |
118 | pub use error::Error; |
119 | pub use server::{Envelope, Server}; |
120 | pub use session::{ |
121 | diff --git a/maitred/src/milter.rs b/maitred/src/milter.rs |
122 | index 28ffde6..b82e257 100644 |
123 | --- a/maitred/src/milter.rs |
124 | +++ b/maitred/src/milter.rs |
125 | @@ -23,7 +23,7 @@ pub trait Milter: Sync + Send { |
126 | /// MilterFunc wraps an async closure implementing the Milter trait. |
127 | /// ```rust |
128 | /// use mail_parser::Message; |
129 | - /// use maitred::MilterFunc; |
130 | + /// use maitred::milter::MilterFunc; |
131 | /// |
132 | /// let milter = MilterFunc(|message: &Message<'static>| { |
133 | /// async move { |
134 | diff --git a/maitred/src/verify.rs b/maitred/src/verify.rs |
135 | index 47e735e..cd93573 100644 |
136 | --- a/maitred/src/verify.rs |
137 | +++ b/maitred/src/verify.rs |
138 | @@ -32,7 +32,7 @@ pub trait Verify { |
139 | /// VerifyFunc wraps an async closure implementing the Verify trait. |
140 | /// # Example |
141 | /// ```rust |
142 | - /// use maitred::VerifyFunc; |
143 | + /// use maitred::verify::VerifyFunc; |
144 | /// use maitred::email_address::EmailAddress; |
145 | /// |
146 | /// let verify = VerifyFunc(|address: &EmailAddress| { |