From f900d0952cb94c88b33f85e9885ae00d6e56cdb5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 27 Oct 2019 08:30:41 -0400 Subject: make tokio features optional --- Cargo.toml | 8 ++++++-- src/error.rs | 2 ++ src/lib.rs | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 39d925f..739575e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,10 @@ keywords = ["ttyrec"] categories = ["parser-implementations"] [dependencies] -futures = "0.1.29" +futures = { version = "0.1.29", optional = true } snafu = "0.5" -tokio = "0.1.22" +tokio = { version = "0.1.22", optional = true } + +[features] +default = ["async"] +async = ["tokio", "futures"] diff --git a/src/error.rs b/src/error.rs index 975889b..c106d02 100644 --- a/src/error.rs +++ b/src/error.rs @@ -17,10 +17,12 @@ pub enum Error { FrameTooLong { input: u64 }, /// failed to read from file + #[cfg(feature = "async")] #[snafu(display("failed to read from file: {}", source))] ReadFile { source: tokio::io::Error }, /// failed to write to file + #[cfg(feature = "async")] #[snafu(display("failed to write to file: {}", source))] WriteFile { source: tokio::io::Error }, } diff --git a/src/lib.rs b/src/lib.rs index 5ae78fa..c08be3a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,7 +20,11 @@ mod frame; pub use frame::Frame; mod parser; pub use parser::Parser; +#[cfg(feature = "async")] mod reader; +#[cfg(feature = "async")] pub use reader::Reader; +#[cfg(feature = "async")] mod writer; +#[cfg(feature = "async")] pub use writer::Writer; -- cgit v1.2.3-54-g00ecf