pub struct Limit<T> { /* private fields */ }
Implementations§
Trait Implementations§
Source§impl<T: BitBufMut> BitBufMut for Limit<T>
impl<T: BitBufMut> BitBufMut for Limit<T>
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> Freeze for Limit<T>where
T: Freeze,
impl<T> RefUnwindSafe for Limit<T>where
T: RefUnwindSafe,
impl<T> Send for Limit<T>where
T: Send,
impl<T> Sync for Limit<T>where
T: Sync,
impl<T> Unpin for Limit<T>where
T: Unpin,
impl<T> UnwindSafe for Limit<T>where
T: UnwindSafe,
Blanket Implementations§
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.