Skip to content

Use all features in docs.rs and use macro for features #57

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 0 additions & 5 deletions .rustfmt.toml

This file was deleted.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 5 additions & 6 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -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
version = "Two"
imports_granularity = "Crate"
format_code_in_doc_comments = true
use_field_init_shorthand = true
wrap_comments = true
40 changes: 25 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion src/uri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
/// ```
Expand Down