pub struct GuestState {
pub self_image_id: Digest,
pub mmr: MerkleMountainRange,
}Fields§
§self_image_id: DigestImage ID of the set builder itself.
Passed as input since a guest cannot contain its own image ID. All successive calls to the set builder must use the same image ID, which is propagated to the journal as part of the guest output.
mmr: MerkleMountainRangeMerkle mountain range representing the state of the iterative tree building process at the end of guest execution.
Implementations§
Source§impl GuestState
impl GuestState
Sourcepub fn initial(self_image_id: impl Into<Digest>) -> Self
pub fn initial(self_image_id: impl Into<Digest>) -> Self
Construct the initial, empty, state for set builder.
Sourcepub fn is_initial(&self) -> bool
pub fn is_initial(&self) -> bool
Returns true if this is the initial state, for an empty claim set.
Sourcepub fn encode(&self) -> Vec<u8> ⓘ
pub fn encode(&self) -> Vec<u8> ⓘ
Encodes the GuestState for committing to the journal. Uses a specialized codec. See MerkleMountainRange::encode.
Sourcepub fn decode(bytes: impl AsRef<[u8]>) -> Result<Self, DecodingError>
pub fn decode(bytes: impl AsRef<[u8]>) -> Result<Self, DecodingError>
Decodes the GuestState for the journal. Uses a specialized codec. See MerkleMountainRange::encode.
Sourcepub fn into_input(
self,
claims: Vec<ReceiptClaim>,
finalize: bool,
) -> Result<GuestInput, Error>
pub fn into_input( self, claims: Vec<ReceiptClaim>, finalize: bool, ) -> Result<GuestInput, Error>
Create a GuestInput from this GuestState. When run with the guest, the given claims
will be accumulated into the Merkle mountain range, and will be finalized if finalize is
set to true.
Will return an error if the MerkleMountainRange on the GuestState is already finalized, as no more claims may be added and the guest would reject this input.
Trait Implementations§
Source§impl Clone for GuestState
impl Clone for GuestState
Source§fn clone(&self) -> GuestState
fn clone(&self) -> GuestState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GuestState
impl Debug for GuestState
Source§impl<'de> Deserialize<'de> for GuestState
impl<'de> Deserialize<'de> for GuestState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for GuestState
impl RefUnwindSafe for GuestState
impl Send for GuestState
impl Sync for GuestState
impl Unpin for GuestState
impl UnwindSafe for GuestState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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