From 112c5969d89f049e9a4136d0f30f22438b569718 Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Sat, 25 Jul 2020 11:03:15 -0400 Subject: [PATCH] feature flags and rustfmt --- .drone.yml | 4 ++-- Cargo.toml | 11 ++++++++--- src/lib.rs | 9 ++++++--- src/status_code.rs | 4 +++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index 80b5d86..5804639 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,7 +6,7 @@ steps: image: "rust:1" pull: always commands: - - cargo test --all + - cargo test --all --all-features when: event: - - push \ No newline at end of file + - push diff --git a/Cargo.toml b/Cargo.toml index d9f2e0a..f7e747e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,12 +10,17 @@ edition = "2018" num = "0.2" num-derive = "0.3" num-traits = "0.2" -rustls = "0.18" -webpki = "0.21.0" -webpki-roots = "0.20" +rustls = { version = "0.18", optional = true } +webpki = { version = "0.21.0", optional = true } +webpki-roots = { version = "0.20", optional = true } log = "0.4" url = "2" thiserror = "1" [dev-dependencies] pretty_env_logger = "0.4" + +[features] +default = ["client"] + +client = ["rustls", "webpki", "webpki-roots"] diff --git a/src/lib.rs b/src/lib.rs index ef4c3f7..dddc4b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,10 @@ -mod client; -mod status_code; mod response; +mod status_code; +pub use response::{Error as ResponseError, Response}; pub use status_code::StatusCode; -pub use response::{Response, Error as ResponseError}; + +#[cfg(feature = "client")] +mod client; +#[cfg(feature = "client")] pub use client::{get, Error as ClientError}; diff --git a/src/status_code.rs b/src/status_code.rs index 62204b3..6a7cf8c 100644 --- a/src/status_code.rs +++ b/src/status_code.rs @@ -119,5 +119,7 @@ pub enum StatusCode { } impl Default for StatusCode { - fn default() -> Self { StatusCode::Success } + fn default() -> Self { + StatusCode::Success + } }