pub type BitSlice<O = u8> = BitSlice<O, Msb0>;
Aliased Type§
pub struct BitSlice<O = u8> { /* private fields */ }
Trait Implementations§
Source§impl BitBuf for &BitSlice
impl BitBuf for &BitSlice
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 BitBufMut for &mut BitSlice
impl BitBufMut for &mut BitSlice
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 more