pub struct Take<T> { /* private fields */ }
Expand description
A BitBuf
adaptor which limits the bits read from an underlying buffer.
Implementations§
Trait Implementations§
Source§impl<T: BitBuf> BitBuf for Take<T>
impl<T: BitBuf> BitBuf for Take<T>
Source§fn advance_bits(&mut self, count: usize)
fn advance_bits(&mut self, count: usize)
Source§fn remaining_bits(&self) -> usize
fn remaining_bits(&self) -> usize
Returns the number of bits between the current position and the end of the buffer. Read more
Source§fn chunk_bits(&self) -> &BitSlice
fn chunk_bits(&self) -> &BitSlice
Returns a
BitSlice
starting at the current position and of length between 0 and
BitBuf::remaining
. Note that this can return a shorter slice.Source§fn chunk_bytes(&self) -> &[u8] ⓘ
fn chunk_bytes(&self) -> &[u8] ⓘ
Returns a slice of bytes starting at the current position and of length between 0 and
BitBuf::remaining_bytes
. Note that this can return a shorter slice.Source§fn byte_aligned(&self) -> bool
fn byte_aligned(&self) -> bool
Returns whether or not this
BitBuf
is fully byte-aligned (beginning and end) with the
underlying storage.Source§fn advance_bytes(&mut self, count: usize)
fn advance_bytes(&mut self, count: usize)
Source§fn remaining_bytes(&self) -> usize
fn remaining_bytes(&self) -> usize
Return the number of full bytes between the current position and the end of the buffer.
Source§fn has_remaining_bits(&self) -> bool
fn has_remaining_bits(&self) -> bool
Returns true if there are any more bits to consume. Read more
Source§fn has_remaining_bytes(&self) -> bool
fn has_remaining_bytes(&self) -> bool
Returns true if there are any more cmplete bytes to consume. Read more
Source§fn chain<U: BitBuf>(self, next: U) -> Chain<Self, U>where
Self: Sized,
fn chain<U: BitBuf>(self, next: U) -> Chain<Self, U>where
Self: Sized,
Creates an adaptor which will chain this buffer to another. Read more
Source§fn copy_to_bit_slice(&mut self, dest: &mut BitSlice)
fn copy_to_bit_slice(&mut self, dest: &mut BitSlice)
fn try_copy_to_bit_slice(&mut self, dest: &mut BitSlice) -> Result<()>
Source§fn copy_to_slice_bytes(&mut self, dest: &mut [u8])
fn copy_to_slice_bytes(&mut self, dest: &mut [u8])
Copy bytes from
self
into dest
. Call should call byte_aligned()
beforehand to ensure
buffer is fully byte-aligned before calling, call may panic if buffer isn’t byte-aligned. Read moreSource§fn try_copy_to_slice_bytes(&mut self, dest: &mut [u8]) -> Result<()>
fn try_copy_to_slice_bytes(&mut self, dest: &mut [u8]) -> Result<()>
Try to copy bytes from
self
into dest
. Returns error if self
is not big enough to
fill dest
or if self is not fully byte-aligned (start and end points both falling on byte
boundaries).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> UnwindSafe for Take<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BitBufExts for T
impl<T> BitBufExts for T
fn get_uN<O: ByteOrder, const N: usize, U, V: Integral>(&mut self) -> Result<U>
fn get_bool(&mut self) -> Result<bool>
fn get_u1(&mut self) -> Result<u1>
fn get_u2(&mut self) -> Result<u2>
fn get_u3(&mut self) -> Result<u3>
fn get_u4(&mut self) -> Result<u4>
fn get_u5(&mut self) -> Result<u5>
fn get_u6(&mut self) -> Result<u6>
fn get_u7(&mut self) -> Result<u7>
fn get_u8(&mut self) -> Result<u8>
fn get_u9<O: ByteOrder>(&mut self) -> Result<u9>
fn get_u10<O: ByteOrder>(&mut self) -> Result<u10>
fn get_u11<O: ByteOrder>(&mut self) -> Result<u11>
fn get_u12<O: ByteOrder>(&mut self) -> Result<u12>
fn get_u13<O: ByteOrder>(&mut self) -> Result<u13>
fn get_u14<O: ByteOrder>(&mut self) -> Result<u14>
fn get_u15<O: ByteOrder>(&mut self) -> Result<u15>
fn get_u16<O: ByteOrder>(&mut self) -> Result<u16>
fn get_u17<O: ByteOrder>(&mut self) -> Result<u17>
fn get_u18<O: ByteOrder>(&mut self) -> Result<u18>
fn get_u19<O: ByteOrder>(&mut self) -> Result<u19>
fn get_u20<O: ByteOrder>(&mut self) -> Result<u20>
fn get_u21<O: ByteOrder>(&mut self) -> Result<u21>
fn get_u22<O: ByteOrder>(&mut self) -> Result<u22>
fn get_u23<O: ByteOrder>(&mut self) -> Result<u23>
fn get_u24<O: ByteOrder>(&mut self) -> Result<u24>
fn get_u25<O: ByteOrder>(&mut self) -> Result<u25>
fn get_u26<O: ByteOrder>(&mut self) -> Result<u26>
fn get_u27<O: ByteOrder>(&mut self) -> Result<u27>
fn get_u28<O: ByteOrder>(&mut self) -> Result<u28>
fn get_u29<O: ByteOrder>(&mut self) -> Result<u29>
fn get_u30<O: ByteOrder>(&mut self) -> Result<u30>
fn get_u31<O: ByteOrder>(&mut self) -> Result<u31>
fn get_u32<O: ByteOrder>(&mut self) -> Result<u32>
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.