Skip to main content

Page

Struct Page 

Source
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: Tag

CH’s tag: the collection’s type’s, as a mutation’s is.

§run: Run

The owner’s run when it built the snapshot.

§asof: Seq

A seq of that run, in the seq’s place: the snapshot reflects every state mutation of its run at or below it.

§time: Time

When the owner built the snapshot; no confirmation.

§index: u32

The page’s index, from 0.

§more: bool

Whether a later page of the snapshot follows.

§coll: u32

The 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

Source

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.

Source

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.

Source

pub const fn header(&self) -> Header

Its CH: a snapshot, the width the run takes, and its tag.

Source

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.

Source

pub fn size(&self) -> usize

Its bytes’ count, CH to its last tombstone, as Page::write writes them.

Source§

impl Page

Source

pub fn members(&self, key: &str) -> Vec<Member>

Its entries as the per-key replies they stand for, live entries and tombstones together in the byte order of their ids, each on its member’s key below key, the key the page was heard on.

Trait Implementations§

Source§

impl Clone for Page

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Page

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Page

Source§

impl Hash for Page

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Page

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

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 Page
where RawVecInner: Send,

§

impl Sync for Page
where RawVecInner: Sync,

§

impl Unpin for Page
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Page

§

impl UnwindSafe for Page
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

fn as_node_mut(&mut self) -> &mut T

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.