pub struct Page {
pub tag: Tag,
pub run: Run,
pub asof: Seq,
pub time: Time,
pub index: u32,
pub more: bool,
pub coll: u32,
pub live: Vec<Entry>,
pub tombs: Vec<Tombstone>,
}Expand description
One page of a snapshot: a GET reply’s payload.
Fields§
§tag: TagCH’s tag: the collection’s type’s, as a mutation’s is.
run: RunThe owner’s run when it built the snapshot.
asof: SeqA seq of that run, in the seq’s place: the snapshot reflects every state mutation of its run at or below it.
time: TimeWhen the owner built the snapshot; no confirmation.
index: u32The page’s index, from 0.
more: boolWhether a later page of the snapshot follows.
coll: u32The collection’s index among the interface’s resources of the reply key’s kind token, in the canonical form’s order (§9.5).
live: Vec<Entry>In the byte order of their ids.
tombs: Vec<Tombstone>In the byte order of their ids, none of them live.
Implementations§
Source§impl Page
impl Page
Sourcepub fn parse(bytes: &[u8]) -> Result<Page, PageRefusal>
pub fn parse(bytes: &[u8]) -> Result<Page, PageRefusal>
A page’s bytes, CH to its last tombstone: the envelope by §7.5’s
parse on a put, which must be a snapshot’s, then its body
(Page::read). The key’s kind is not read here:
crate::wire::read_put refuses a snapshot off a state key.
§Errors
The envelope’s refusal, a form other than a snapshot, or the body’s first refusal.
Sourcepub fn read(envelope: &Envelope<'_>) -> Result<Page, PageRefusal>
pub fn read(envelope: &Envelope<'_>) -> Result<Page, PageRefusal>
A snapshot’s envelope with its body read: the body’s fields in order, with the header’s run, refused for the first that applies (core §7.5, “Reading a snapshot’s body”).
§Errors
PageRefusal::NotSnapshot for an envelope of another form, and
PageRefusal::Body with the first BodyRefusal that applies.
Sourcepub fn write(&self) -> Result<Vec<u8>, BodyRefusal>
pub fn write(&self) -> Result<Vec<u8>, BodyRefusal>
The page’s bytes, CH to its last tombstone, or the refusal its reading would give, the first in reading order: a writer writes no page the reading refuses (core §7.5).
§Errors
time, id, order or run for a field the reading would
refuse, and leb128 for an index, a count or a length above 2^32 −
1 as an integer.
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Its bytes’ count, CH to its last tombstone, as Page::write
writes them.
Trait Implementations§
impl Eq for Page
impl StructuralPartialEq for Page
Auto Trait Implementations§
impl Forget for Page
impl Freeze for Page
impl Move for Page
impl RefUnwindSafe for Page
impl Send for Pagewhere
RawVecInner: Send,
impl Sync for Pagewhere
RawVecInner: Sync,
impl Unpin for Page
impl UnsafeUnpin for Pagewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Entry>: UnsafeUnpin,
PhantomData<Tombstone>: UnsafeUnpin,
impl UnwindSafe for Pagewhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more