diff --git a/.rustfmt.toml b/.rustfmt.toml deleted file mode 100644 index b4d1e94..0000000 --- a/.rustfmt.toml +++ /dev/null @@ -1,5 +0,0 @@ -version = "Two" -use_field_init_shorthand = true -merge_imports = true -wrap_comments = true -use_try_shorthand = true \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index fc2c070..7d18aa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,3 +41,6 @@ required-features = ["server", "hyper/runtime"] [[test]] name = "server_client" required-features = ["client", "server", "hyper/runtime"] + +[package.metadata.docs.rs] +all-features = true diff --git a/rustfmt.toml b/rustfmt.toml index 0f780d3..82dc1c9 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,6 +1,5 @@ -# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_args_layout -fn_args_layout = "Vertical" -# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports -merge_imports = true -# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#format_code_in_doc_comments -format_code_in_doc_comments = true \ No newline at end of file +version = "Two" +imports_granularity = "Crate" +format_code_in_doc_comments = true +use_field_init_shorthand = true +wrap_comments = true diff --git a/src/lib.rs b/src/lib.rs index 0a64652..f5ec99b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,23 +21,33 @@ //! //! # Features //! -//! - Client- enables the client extension trait and connector. *Enabled by -//! default*. +//! - Client- enables the client extension trait and connector. //! -//! - Server- enables the server extension trait. *Enabled by default*. - -#[cfg(feature = "client")] -mod client; -#[cfg(feature = "client")] -pub use client::{UnixClientExt, UnixConnector}; - -#[cfg(feature = "server")] -mod server; -#[cfg(feature = "server")] -pub use server::UnixServerExt; +//! - Server- enables the server extension trait. mod uri; pub use uri::Uri; -#[cfg(feature = "server")] -pub use crate::server::conn::SocketIncoming; +macro_rules! attr_each { + (#[$meta:meta] $($item:item)*) => { + $( + #[$meta] + $item + )* + } +} + +attr_each! { + #[cfg(feature = "client")] + + mod client; + pub use client::{UnixClientExt, UnixConnector}; +} + +attr_each! { + #[cfg(feature = "server")] + + mod server; + pub use server::UnixServerExt; + pub use server::conn::SocketIncoming; +} diff --git a/src/uri.rs b/src/uri.rs index 23fb167..3c4723e 100644 --- a/src/uri.rs +++ b/src/uri.rs @@ -7,8 +7,8 @@ use std::path::Path; /// /// # Example /// ``` -/// use hyperlocal::Uri; /// use hyper::Uri as HyperUri; +/// use hyperlocal::Uri; /// /// let uri: HyperUri = Uri::new("/tmp/hyperlocal.sock", "/").into(); /// ```