pub struct RawReader<'a, T: SpanWeight<Slab> + HasPos> { /* private fields */ }Expand description
A low-level reader for sequential byte access across a multi-slab tree.
Unlike column iterators, RawReader reads raw bytes rather than decoded values.
It is used internally by Automerge to access byte fields (e.g. actor IDs, string
payloads) that are stored as consecutive byte ranges across slab boundaries.
Obtain a RawReader via ColumnData::raw_reader.
Implementations§
Source§impl<'a, T: SpanWeight<Slab> + HasPos> RawReader<'a, T>
impl<'a, T: SpanWeight<Slab> + HasPos> RawReader<'a, T>
pub fn empty() -> RawReader<'static, T>
Sourcepub fn read_next(&mut self, length: usize) -> Result<&'a [u8], ReadRawError>
pub fn read_next(&mut self, length: usize) -> Result<&'a [u8], ReadRawError>
Read a slice out of a set of slabs
Returns an error if:
- The read would cross a slab boundary
- The read would go past the end of the data
pub fn seek_to(&mut self, advance: usize)
Sourcepub fn suspend(&self) -> usize
pub fn suspend(&self) -> usize
Returns the current byte position, which can be passed to
ColumnData::raw_reader to reconstruct a RawReader
at the same position.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for RawReader<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for RawReader<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for RawReader<'a, T>
impl<'a, T> Sync for RawReader<'a, T>where
T: Sync,
impl<'a, T> Unpin for RawReader<'a, T>where
T: Unpin,
impl<'a, T> UnsafeUnpin for RawReader<'a, T>where
T: UnsafeUnpin,
impl<'a, T> UnwindSafe for RawReader<'a, T>where
T: UnwindSafe + RefUnwindSafe,
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