pub struct PackReader<'a> { /* private fields */ }Expand description
A pack as it reads: its space, the update that wrote it, and its items, one after the other, each checked as it is read.
Implementations§
Source§impl<'a> PackReader<'a>
impl<'a> PackReader<'a>
Sourcepub fn new(bytes: &'a [u8]) -> Result<Self, SyncError>
pub fn new(bytes: &'a [u8]) -> Result<Self, SyncError>
Starts reading a pack from its bytes.
§Errors
Returns SyncError::Protocol if the bytes do not start with a pack’s first value.
Sourcepub fn item_at(space: SpaceId, bytes: &[u8]) -> Result<PackItem, SyncError>
pub fn item_at(space: SpaceId, bytes: &[u8]) -> Result<PackItem, SyncError>
The item whose encoding bytes holds whole, as PackReader::next_item found it
in a pack of space.
§Errors
Returns SyncError::Protocol if bytes is not exactly one such item.
Sourcepub fn next_item(
&mut self,
) -> Result<Option<(PackItem, usize, usize)>, SyncError>
pub fn next_item( &mut self, ) -> Result<Option<(PackItem, usize, usize)>, SyncError>
The next item, with where its encoding starts in the pack and how long it is, or
None at the pack’s end.
§Errors
Returns SyncError::Protocol if what follows is no item of the pack’s space, or a
blob whose bytes do not have its sealed hash, or is larger than MOST_PACK_BLOB.
Auto Trait Implementations§
impl<'a> Forget for PackReader<'a>
impl<'a> Freeze for PackReader<'a>
impl<'a> Move for PackReader<'a>
impl<'a> RefUnwindSafe for PackReader<'a>
impl<'a> Send for PackReader<'a>
impl<'a> Sync for PackReader<'a>
impl<'a> Unpin for PackReader<'a>
impl<'a> UnsafeUnpin for PackReader<'a>
impl<'a> UnwindSafe for PackReader<'a>
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