From 1d8b4e75b0fb12125d294b8231f170c9603d2de6 Mon Sep 17 00:00:00 2001 From: Laura Loghin Date: Fri, 27 Nov 2020 18:39:03 +0200 Subject: [PATCH] hide StdIoBackend behind backend-stdio feature Signed-off-by: Laura Loghin --- Cargo.toml | 3 +++ coverage_config_aarch64.json | 2 +- coverage_config_x86_64.json | 2 +- src/block/mod.rs | 5 ++++- src/lib.rs | 7 +++---- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 587ab07c..10c113bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,9 @@ readme = "README.md" license = "Apache-2.0 OR MIT" edition = "2018" +[features] +backend-stdio = [] + [dependencies] byteorder = ">=1.2.1" libc = ">=0.2.39" diff --git a/coverage_config_aarch64.json b/coverage_config_aarch64.json index 4361d9e8..23f52a39 100644 --- a/coverage_config_aarch64.json +++ b/coverage_config_aarch64.json @@ -1,5 +1,5 @@ { "coverage_score": 85.6, "exclude_path": "", - "crate_features": "" + "crate_features": "backend-stdio" } diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json index 7abd6c69..82e90d86 100644 --- a/coverage_config_x86_64.json +++ b/coverage_config_x86_64.json @@ -1,5 +1,5 @@ { "coverage_score": 87.7, "exclude_path": "", - "crate_features": "" + "crate_features": "backend-stdio" } diff --git a/src/block/mod.rs b/src/block/mod.rs index 0bed4754..3123f739 100644 --- a/src/block/mod.rs +++ b/src/block/mod.rs @@ -4,5 +4,8 @@ /// Contains block request parsing abstraction. pub mod request; -/// Contains block request execution abstraction. +/// Contains a block request execution abstraction that is based on +/// [`std::io::Read`](https://doc.rust-lang.org/std/io/trait.Read.html) +/// and [`std::io::Write`](https://doc.rust-lang.org/std/io/trait.Write.html). +#[cfg(feature = "backend-stdio")] pub mod stdio_executor; diff --git a/src/lib.rs b/src/lib.rs index c23dee19..dc200fec 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,10 +19,9 @@ pub mod block; mod device; mod queue; -pub use self::block::{ - request::Request as BlockRequest, request::RequestType as BlockRequestType, - stdio_executor::StdIoBackend, -}; +#[cfg(feature = "backend-stdio")] +pub use self::block::stdio_executor::StdIoBackend; +pub use self::block::{request::Request as BlockRequest, request::RequestType as BlockRequestType}; pub use self::device::*; pub use self::queue::*;