Skip to main content

LifecycleCapsule

Struct LifecycleCapsule 

Source
pub struct LifecycleCapsule { /* private fields */ }
Expand description

Every protocol-owned value of one conversation’s lifecycle at a log position. Built only by LifecycleCapsule::capture or LifecycleCapsule::decode_canonical.

Implementations§

Source§

impl LifecycleCapsule

Source

pub fn capture(view: &LifecycleView<'_>) -> Result<Self, CapsuleCaptureError>

Captures the lent values. Nothing is consumed; generic digests are copied out of the borrowed values.

§Errors

Returns CapsuleCaptureError when the frontiers belong to another conversation, the participants are not strictly ascending, the live closure cannot be described, or a count or length does not fit u32.

Source

pub const fn conversation_id(&self) -> ConversationId

The conversation these values belong to.

Source

pub const fn covered_log_sequence(&self) -> u64

The last log sequence whose effects the capsule includes.

Source

pub fn encode_canonical(&self) -> Vec<u8> ⓘ

Encodes the stable v1 capsule envelope in network byte order.

Source

pub fn decode_canonical(input: &[u8]) -> Result<Self, CapsuleDecodeError>

Decodes one exact canonical v1 capsule.

§Errors

Returns CapsuleDecodeError for truncation, an invalid magic prefix, an unsupported codec version, a declared length that differs from the supplied bytes, a section out of order, missing, unknown or of the wrong length, a section whose fields break their invariants, participants out of order, or frontiers that belong to another conversation.

Source

pub fn restore(self) -> Result<RestoredLifecycle, CapsuleRestoreError>

Validates the capsule as a whole and hands back the live values.

The lifecycle goes through the one joint participant-conversation validation, through its crate-private entry that also checks and installs the fenced-marker issuance latch the capsule carried: a latch naming a take the restored state could not have granted is refused.

§Errors

Returns CapsuleRestoreError when the capsule’s sections are inconsistent with each other or with their own invariants.

Trait Implementations§

Source§

impl Debug for LifecycleCapsule

Source§

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

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

impl Eq for LifecycleCapsule

Source§

impl PartialEq for LifecycleCapsule

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 LifecycleCapsule

Auto Trait Implementations§

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> 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<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, 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.