pub struct SliceReadFixed<'a, 'b> { /* private fields */ }
Expand description
A CBOR input source that reads from a slice of bytes using a fixed size scratch buffer.
SliceRead
and MutSliceRead
are usually
preferred over this, as they can handle indefinite length items.
Implementations§
Source§impl<'a, 'b> SliceReadFixed<'a, 'b>
impl<'a, 'b> SliceReadFixed<'a, 'b>
Sourcepub fn new(slice: &'a [u8], scratch: &'b mut [u8]) -> SliceReadFixed<'a, 'b>
pub fn new(slice: &'a [u8], scratch: &'b mut [u8]) -> SliceReadFixed<'a, 'b>
Creates a CBOR input source to read from a slice of bytes, backed by a scratch buffer.
Trait Implementations§
Source§impl<'a, 'b> Debug for SliceReadFixed<'a, 'b>
impl<'a, 'b> Debug for SliceReadFixed<'a, 'b>
Source§impl<'a, 'b> Read<'a> for SliceReadFixed<'a, 'b>
impl<'a, 'b> Read<'a> for SliceReadFixed<'a, 'b>
Source§fn peek(&mut self) -> Result<Option<u8>>
fn peek(&mut self) -> Result<Option<u8>>
Peek at the next byte of the input, if any. This does not advance the reader, so the result
of this function will remain the same until a read or clear occurs.
Source§fn clear_buffer(&mut self)
fn clear_buffer(&mut self)
Clear the underlying scratch buffer
Source§fn read_to_buffer(&mut self, n: usize) -> Result<()>
fn read_to_buffer(&mut self, n: usize) -> Result<()>
Append n bytes from the reader to the reader’s scratch buffer (without clearing it)
Source§fn read<'c>(&'c mut self, n: usize) -> Result<EitherLifetime<'c, 'a>>
fn read<'c>(&'c mut self, n: usize) -> Result<EitherLifetime<'c, 'a>>
Read n bytes from the input. Read more
Source§fn take_buffer<'c>(&'c mut self) -> EitherLifetime<'c, 'a>
fn take_buffer<'c>(&'c mut self) -> EitherLifetime<'c, 'a>
Read out everything accumulated in the reader’s scratch buffer. This may, as a side effect,
clear it.
Auto Trait Implementations§
impl<'a, 'b> Freeze for SliceReadFixed<'a, 'b>
impl<'a, 'b> RefUnwindSafe for SliceReadFixed<'a, 'b>
impl<'a, 'b> Send for SliceReadFixed<'a, 'b>
impl<'a, 'b> Sync for SliceReadFixed<'a, 'b>
impl<'a, 'b> Unpin for SliceReadFixed<'a, 'b>
impl<'a, 'b> !UnwindSafe for SliceReadFixed<'a, 'b>
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes