Struct perseus::state::PssEntry

source ·
pub struct PssEntry { /* private fields */ }
Expand description

An entry for a single page in the PSS. This type has no concern for the actual type of the page state it stores.

Note: while it is hypothetically possible for this to hold neither a state nor document metadata, that will never happen without user intervention.

Implementations§

source§

impl PssEntry

source

pub fn set_state_never(&mut self)

Declare that this entry will never have state. This should be done by macros that definitively know the structure of a page. This action is revocable under HSR conditions only.

Note that this will not be preserved in freezing (allowing greater flexibility of HSR).

source

pub fn set_head(&mut self, head: String)

Adds document metadata to this entry.

source

pub fn set_state( &mut self, state: Box<dyn AnyFreeze> ) -> Result<(), ClientError>

Adds state to this entry. This will return an error if this entry has previously been marked as having no state.

If we’re setting state for HSR, this function’s should be interpreted with caution: if the user has added state to a template/capsule that previously didn’t have state, then nothing in the code will try to set it to never having had state (and there will be nothing in the frozen state for it), which is fine; but, if they removed state from an entity that previously had it, this will return an error to the HSR thaw attempt (which will try to add the old state back). In that case, the error should be discarded by the caller, who should accept the changed data model.

Trait Implementations§

source§

impl Debug for PssEntry

source§

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

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

impl Default for PssEntry

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.