diff options
Diffstat (limited to 'src/buf/buf_impl.rs')
-rw-r--r-- | src/buf/buf_impl.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/buf/buf_impl.rs b/src/buf/buf_impl.rs index e126bb4..b9e9141 100644 --- a/src/buf/buf_impl.rs +++ b/src/buf/buf_impl.rs @@ -1,6 +1,14 @@ -use super::{Take, Reader, Chain}; +use super::{Take, Chain}; -use std::{cmp, io::IoSlice, ptr, mem}; +#[cfg(feature = "std")] +use super::Reader; + +use core::{cmp, ptr, mem}; + +#[cfg(feature = "std")] +use std::io::IoSlice; + +use alloc::{boxed::Box}; macro_rules! buf_get_impl { ($this:ident, $typ:tt::$conv:tt) => ({ @@ -148,6 +156,7 @@ pub trait Buf { /// with `dst` being a zero length slice. /// /// [`writev`]: http://man7.org/linux/man-pages/man2/readv.2.html + #[cfg(feature = "std")] fn bytes_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize { if dst.is_empty() { return 0; @@ -884,6 +893,7 @@ pub trait Buf { /// assert_eq!(11, num); /// assert_eq!(&dst[..11], &b"hello world"[..]); /// ``` + #[cfg(feature = "std")] fn reader(self) -> Reader<Self> where Self: Sized { super::reader::new(self) } @@ -915,6 +925,7 @@ impl<T: Buf + ?Sized> Buf for &mut T { (**self).bytes() } + #[cfg(feature = "std")] fn bytes_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize { (**self).bytes_vectored(dst) } @@ -933,6 +944,7 @@ impl<T: Buf + ?Sized> Buf for Box<T> { (**self).bytes() } + #[cfg(feature = "std")] fn bytes_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize { (**self).bytes_vectored(dst) } |