aboutsummaryrefslogtreecommitdiff
path: root/src/buf/mod.rs
diff options
context:
space:
mode:
authorGravatar Chris Beck <beck.ct@gmail.com> 2019-09-05 14:00:23 -0700
committerGravatar Carl Lerche <me@carllerche.com> 2019-09-05 14:00:23 -0700
commitc17e40115f5bb2a2db71ed90dceae6ec643dc024 (patch)
tree5457d4a726f8e16120c02976fa8b07caf07df0f1 /src/buf/mod.rs
parent73426dfaa3e56884977d7822b79696ac2cc96a42 (diff)
downloadbytes-c17e40115f5bb2a2db71ed90dceae6ec643dc024.tar.gz
bytes-c17e40115f5bb2a2db71ed90dceae6ec643dc024.tar.zst
bytes-c17e40115f5bb2a2db71ed90dceae6ec643dc024.zip
Add no_std support, by adding an `std` feature (#281)
To make the library work as `no_std` we add an `std` feature which is on by default. When it is off, we compile as `no_std` and make parts of the API that require `std::io` conditional on the `std` feature.
Diffstat (limited to 'src/buf/mod.rs')
-rw-r--r--src/buf/mod.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buf/mod.rs b/src/buf/mod.rs
index cd7373e..15e032d 100644
--- a/src/buf/mod.rs
+++ b/src/buf/mod.rs
@@ -20,15 +20,21 @@ mod buf_impl;
mod buf_mut;
mod chain;
mod iter;
-mod reader;
mod take;
mod vec_deque;
+
+// When std::io::Reader etc. traits are not available, skip these
+#[cfg(feature = "std")]
+mod reader;
+#[cfg(feature = "std")]
mod writer;
pub use self::buf_impl::Buf;
pub use self::buf_mut::BufMut;
pub use self::chain::Chain;
pub use self::iter::IntoIter;
+#[cfg(feature = "std")]
pub use self::reader::Reader;
pub use self::take::Take;
+#[cfg(feature = "std")]
pub use self::writer::Writer;