#[non_exhaustive]pub struct Take<T> {
#[doc(hidden)] pub inner: T,
#[doc(hidden)] pub len: u64,
#[doc(hidden)] pub limit: u64,
}🔬This is a nightly-only experimental API. (
core_io #154046)Expand description
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.#[doc(hidden)]inner: T🔬This is a nightly-only experimental API. (
§core_io_internals)#[doc(hidden)]len: u64🔬This is a nightly-only experimental API. (
§core_io_internals)#[doc(hidden)]limit: u64🔬This is a nightly-only experimental API. (
core_io_internals)Implementations§
Source§impl<T> Take<T>
impl<T> Take<T>
1.0.0 · Sourcepub fn limit(&self) -> u64
pub fn limit(&self) -> u64
Sourcepub fn position(&self) -> u64
🔬This is a nightly-only experimental API. (seek_io_take_position #97227)
pub fn position(&self) -> u64
seek_io_take_position #97227)Returns the number of bytes read so far.
1.27.0 · Sourcepub fn set_limit(&mut self, limit: u64)
pub fn set_limit(&mut self, limit: u64)
Sets the number of bytes that can be read before this instance will
return EOF. This is the same as constructing a new Take instance, so
the amount of bytes read and the previous limit value don’t matter when
calling this method.
§Examples
1.15.0 · Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the Take, returning the wrapped reader.
§Examples
1.20.0 · Sourcepub fn get_ref(&self) -> &T
pub fn get_ref(&self) -> &T
Gets a reference to the underlying reader.
Care should be taken to avoid modifying the internal I/O state of the
underlying reader as doing so may corrupt the internal limit of this
Take.
§Examples
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Take<T>where
T: Freeze,
impl<T> RefUnwindSafe for Take<T>where
T: RefUnwindSafe,
impl<T> Send for Take<T>where
T: Send,
impl<T> Sync for Take<T>where
T: Sync,
impl<T> Unpin for Take<T>where
T: Unpin,
impl<T> UnsafeUnpin for Take<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Take<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)]const SIZE: usize = _
#[doc(hidden)]const SIZE: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGN: usize = _
#[doc(hidden)]const ALIGN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
🔬This is a nightly-only experimental API. (
ptr_alignment_type #102070)Source§#[doc(hidden)]const IS_ZST: bool = _
#[doc(hidden)]const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const LAYOUT: Layout = _
#[doc(hidden)]const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties)Source§#[doc(hidden)]const MAX_SLICE_LEN: usize = _
#[doc(hidden)]const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties)The largest safe length for a
[Self]. Read more