pub struct Chain<T, U> { /* private fields */ }
Expand description
A Chain
sequences to BitBuf
s.
Chain
is an adaptor that links to underlying buffers and provides a continuous view across
both.
Implementations§
Trait Implementations§
Source§impl<T, U> BitBuf for Chain<T, U>
impl<T, U> BitBuf for Chain<T, U>
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).Source§impl<T, U> BitBufMut for Chain<T, U>
impl<T, U> BitBufMut for Chain<T, U>
Source§fn advance_mut_bits(&mut self, count: usize)
fn advance_mut_bits(&mut self, count: usize)
Advance the internal cursor of the BitBufMut by
count
bits. Read moreSource§fn chunk_mut_bits(&mut self) -> &mut BitSlice
fn chunk_mut_bits(&mut self) -> &mut BitSlice
Returns a mutable
BitSlice
starting at the current BitBufMut
position and of length
between 0 and BitBufMut::remaining_mut(). Note that this can be shorter than the whole
remainder of the buffer (this allows non-continuous implementation). Read moreSource§fn chunk_mut_bytes(&mut self) -> &mut UninitSlice
fn chunk_mut_bytes(&mut self) -> &mut UninitSlice
Returns a mutable
UninitSlice
starting at the current BitBufMut
position and of length
between 0 and BitBufMut::remaining_mut(). Note that this can be shorter than the whole
remainder of the buffer (this allows non-continuous implementation). This BitBufMut
must be fully byte-aligned for this to work: caller should check byte_aligned
before
calling. Read moreSource§fn remaining_mut_bits(&self) -> usize
fn remaining_mut_bits(&self) -> usize
Returns the number of bits that can be written from the current position until the end of
the buffer is reached. Note that the returned value may under-represent the remainin
amount: we are returning the value in bits but if the underlying storage is in bytes then
the result here will be under-represented by a factor of 8.
remaining_mut_bytes
will
give a more accurate view of how much space (in bytes) is remaining. Read moreSource§fn byte_aligned_mut(&self) -> bool
fn byte_aligned_mut(&self) -> bool
Returns whether or not this
BitBufMut
is fully byte-aligned (beginning and end) with the
underlying storage.Source§fn advance_mut_bytes(&mut self, count: usize)
fn advance_mut_bytes(&mut self, count: usize)
Advance the internal cursor of the BitBufMut by
count
bytes. Read moreSource§fn limit_bits(self, limit: usize) -> Limit<Self>where
Self: Sized,
fn limit_bits(self, limit: usize) -> Limit<Self>where
Self: Sized,
Creates an adaptor which can write at most
limit
bits to self
Source§fn limit_bytes(self, limit: usize) -> Limit<Self>where
Self: Sized,
fn limit_bytes(self, limit: usize) -> Limit<Self>where
Self: Sized,
Creates an adaptor which can write at most
limit
bytes to self
Source§fn has_remaining_mut_bits(&self) -> bool
fn has_remaining_mut_bits(&self) -> bool
Returns true if there is space in self for more bits. Read more
Source§fn remaining_mut_bytes(&self) -> usize
fn remaining_mut_bytes(&self) -> usize
Returns the number of full bytes that can be written from the current position until the
end of the buffer is reached. Read more
Source§fn has_reminaing_mut_bytes(&self) -> bool
fn has_reminaing_mut_bytes(&self) -> bool
Returns true if there is space in self for more bytes. Read more
Source§fn chain_mut<U: BitBufMut>(self, next: U) -> Chain<Self, U>where
Self: Sized,
fn chain_mut<U: BitBufMut>(self, next: U) -> Chain<Self, U>where
Self: Sized,
Creates an adaptor which will chain this buffer to another. Read more
Source§fn put_bit_slice(&mut self, src: &BitSlice)
fn put_bit_slice(&mut self, src: &BitSlice)
Source§fn try_put_bit_slice(&mut self, src: &BitSlice) -> Result<()>
fn try_put_bit_slice(&mut self, src: &BitSlice) -> Result<()>
Try to transfer bits info
self
from src
and advance the cursor by the number of bits
written. Read morefn try_put_slice_bytes(&mut self, src: &[u8]) -> Result<()>
Auto Trait Implementations§
impl<T, U> Freeze for Chain<T, U>
impl<T, U> RefUnwindSafe for Chain<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Chain<T, U>
impl<T, U> Sync for Chain<T, U>
impl<T, U> Unpin for Chain<T, U>
impl<T, U> UnwindSafe for Chain<T, U>where
T: UnwindSafe,
U: 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> BitBufMutExts for T
impl<T> BitBufMutExts for T
fn put_uN<O: ByteOrder, const N: usize, U, V: Integral>(
&mut self,
value: U,
) -> Result<()>where
U: Into<V>,
fn put_bool(&mut self, value: bool) -> Result<()>
fn put_u1(&mut self, value: u1) -> Result<()>
fn put_u2(&mut self, value: u2) -> Result<()>
fn put_u3(&mut self, value: u3) -> Result<()>
fn put_u4(&mut self, value: u4) -> Result<()>
fn put_u5(&mut self, value: u5) -> Result<()>
fn put_u6(&mut self, value: u6) -> Result<()>
fn put_u7(&mut self, value: u7) -> Result<()>
fn put_u8(&mut self, value: u8) -> Result<()>
fn put_u9<O: ByteOrder>(&mut self, value: u9) -> Result<()>
fn put_u10<O: ByteOrder>(&mut self, value: u10) -> Result<()>
fn put_u11<O: ByteOrder>(&mut self, value: u11) -> Result<()>
fn put_u12<O: ByteOrder>(&mut self, value: u12) -> Result<()>
fn put_u13<O: ByteOrder>(&mut self, value: u13) -> Result<()>
fn put_u14<O: ByteOrder>(&mut self, value: u14) -> Result<()>
fn put_u15<O: ByteOrder>(&mut self, value: u15) -> Result<()>
fn put_u16<O: ByteOrder>(&mut self, value: u16) -> Result<()>
fn put_u17<O: ByteOrder>(&mut self, value: u17) -> Result<()>
fn put_u18<O: ByteOrder>(&mut self, value: u18) -> Result<()>
fn put_u19<O: ByteOrder>(&mut self, value: u19) -> Result<()>
fn put_u20<O: ByteOrder>(&mut self, value: u20) -> Result<()>
fn put_u21<O: ByteOrder>(&mut self, value: u21) -> Result<()>
fn put_u22<O: ByteOrder>(&mut self, value: u22) -> Result<()>
fn put_u23<O: ByteOrder>(&mut self, value: u23) -> Result<()>
fn put_u24<O: ByteOrder>(&mut self, value: u24) -> Result<()>
fn put_u25<O: ByteOrder>(&mut self, value: u25) -> Result<()>
fn put_u26<O: ByteOrder>(&mut self, value: u26) -> Result<()>
fn put_u27<O: ByteOrder>(&mut self, value: u27) -> Result<()>
fn put_u28<O: ByteOrder>(&mut self, value: u28) -> Result<()>
fn put_u29<O: ByteOrder>(&mut self, value: u29) -> Result<()>
fn put_u30<O: ByteOrder>(&mut self, value: u30) -> Result<()>
fn put_u31<O: ByteOrder>(&mut self, value: u31) -> Result<()>
fn put_u32<O: ByteOrder>(&mut self, value: u32) -> Result<()>
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.