From a62782a86ff8618903dd49e8d357188ca94dc711 Mon Sep 17 00:00:00 2001 From: Philipp Korber Date: Thu, 22 Nov 2018 17:48:45 +0100 Subject: refactor(mail/deps) changed the mail facade to mirror changes in dependencies --- mail/Cargo.toml | 28 ++++++++++++----------- mail/src/lib.rs | 69 ++++++++++++++++++++++----------------------------------- 2 files changed, 42 insertions(+), 55 deletions(-) diff --git a/mail/Cargo.toml b/mail/Cargo.toml index 2a3a25f..2d55b36 100644 --- a/mail/Cargo.toml +++ b/mail/Cargo.toml @@ -13,33 +13,35 @@ autoexamples = false [features] smtp = ["mail-smtp"] -#askama-engine = ["mail-template/askama-engine"] -#tera-engine = ["render-template-engine", "mail-render-template-engine/tera-engine"] -#handlebars-engine = ["render-template-engine", "mail-render-template-engine/handlebars-engine"] -#render-template-engine = ["mail-render-template-engine"] +handlebars = ["mail-template/handlebars-bindings"] traceing = ["mail-internals/traceing", "mail-headers/traceing"] test-utils = ["mail-core/test-utils"] -# [[example]] -# name = "mail-from_template" -# crate-type = ["bin"] -# path = "examples/mail_from_template/main.rs" -# required-feature = ["render-template-engine", "tera-engine"] +[[example]] +name = "mail_by_hand" +crate-type = ["bin"] +path = "examples/mail_by_hand.rs" [[example]] -name = "send_mail" +name = "mail_from_template" crate-type = ["bin"] +path = "examples/mail_from_template/main.rs" +required-features = ["handlebars"] + +[[example]] +name = "send_mail" +create-type = ["bind"] path = "examples/send_mail/main.rs" +required-features = ["smtp"] + [dependencies] mail-internals = { path="../internals" } mail-headers = { path="../headers" } mail-core = { path="../core" } -#mail-template = { git="https://github.com/1aim/mail-template" } -#mail-derive = { git="https://github.com/1aim/mail-derive" } +mail-template = { path="../template" } mail-smtp = { path="../smtp", optional=true } -#mail-render-template-engine = {git="https://github.com/1aim/mail-render-template-engine", optional=true } [dev-dependencies] rpassword = "2.0.0" diff --git a/mail/src/lib.rs b/mail/src/lib.rs index 56fe2c2..dd0eeb7 100644 --- a/mail/src/lib.rs +++ b/mail/src/lib.rs @@ -97,23 +97,19 @@ //! re-exported as it can be seen as an internal part of the implementation //! which normally doesn't need to be accessed directly. -extern crate mail_internals; -#[allow(unused_imports)] +#[doc(hidden)] +pub extern crate mail_internals; extern crate mail_headers; -pub extern crate mail_core as mail; -//pub extern crate mail_template as template; -//#[macro_use] -//#[allow(unused_imports)] -//extern crate mail_derive; +extern crate mail_core; +pub extern crate mail_template as template; +use self::template as mail_template; #[cfg(feature="smtp")] pub extern crate mail_smtp as smtp; -//#[cfg(feature="render-template-engine")] -//pub extern crate mail_render_template_engine as render_template_engine; - -//#[cfg(feature="tera-engine")] -//pub use render_template_engine::tera; -//pub use mail_derive::*; +/// Re-export of all parts of the `mail_core` crate. +/// +/// Some parts like `error`/`default_impl` will get overridden. +pub use mail_core::*; /// re-export of all error types /// @@ -127,17 +123,13 @@ pub mod error { pub use mail_internals::error::*; pub use mail_headers::error::*; pub use mail_headers::InvalidHeaderName; - pub use mail::error::*; - //pub use template::error::*; + pub use mail_core::error::*; + pub use mail_template::error::*; #[cfg(feature="smtp")] pub use smtp::error::*; } -/// re-export of the context module -pub use mail::context; - -//#[cfg(feature="askama-engine")] -//pub use template::askama_engine as askama; +pub use mail_internals::MailType; /// Re-export of headers from `mail-headers`. pub use mail_headers::{ @@ -157,38 +149,31 @@ pub use mail_headers::{ Header, HeaderName, - HeaderMap + HeaderMap, + + def_headers, +}; + +pub use self::header_components::{ + MediaType, + Mailbox, + Email, + Domain }; + #[doc(hidden)] pub use mail_headers::data; -/// Re-export of the default_impl parts from both `mail-core` and `mail-template`. +/// Re-export of the default_impl parts from `mail-core`. /// /// This provides default implementations for a number of traits which might be needed /// for using some parts of the crates, e.g. a simple implementation of `BuilderContext`. pub mod default_impl { - pub use mail::default_impl::*; + pub use mail_core::default_impl::*; } #[cfg(feature="test-utils")] pub mod test_utils { - pub use mail::test_utils::*; -} - -pub use mail_internals::MailType; - -pub use self::header_components::{ - MediaType, - Mailbox, - Email, - Domain -}; - -pub use mail::{ - Mail, - Resource, - IRI, - Source, - Context -}; + pub use mail_core::test_utils::*; +} \ No newline at end of file -- cgit v1.2.3