Struct locutus_runtime::prelude::StateSummary
source · pub struct StateSummary<'a>(_);Expand description
Summary of State changes.
Given a contract state, this is a small piece of data that can be used to determine a delta between two contracts as part of the state synchronization mechanism. The format of a state summary is determined by the state’s contract.
Implementations§
source§impl StateSummary<'_>
impl StateSummary<'_>
pub fn into_owned(self) -> StateSummary<'static>
Methods from Deref<Target = Cow<'a, [u8]>>§
sourcepub fn is_borrowed(&self) -> bool
🔬This is a nightly-only experimental API. (cow_is_borrowed)
pub fn is_borrowed(&self) -> bool
cow_is_borrowed)Returns true if the data is borrowed, i.e. if to_mut would require additional work.
Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow = Cow::Borrowed("moo");
assert!(cow.is_borrowed());
let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
assert!(!bull.is_borrowed());sourcepub fn is_owned(&self) -> bool
🔬This is a nightly-only experimental API. (cow_is_borrowed)
pub fn is_owned(&self) -> bool
cow_is_borrowed)Returns true if the data is owned, i.e. if to_mut would be a no-op.
Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
assert!(cow.is_owned());
let bull = Cow::Borrowed("...moo?");
assert!(!bull.is_owned());1.0.0 · sourcepub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned
pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned
Acquires a mutable reference to the owned form of the data.
Clones the data if it is not already owned.
Examples
use std::borrow::Cow;
let mut cow = Cow::Borrowed("foo");
cow.to_mut().make_ascii_uppercase();
assert_eq!(
cow,
Cow::Owned(String::from("FOO")) as Cow<str>
);Trait Implementations§
source§impl<'a> AsRef<[u8]> for StateSummary<'a>
impl<'a> AsRef<[u8]> for StateSummary<'a>
source§impl<'a> Clone for StateSummary<'a>
impl<'a> Clone for StateSummary<'a>
source§fn clone(&self) -> StateSummary<'a>
fn clone(&self) -> StateSummary<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<'a> Debug for StateSummary<'a>
impl<'a> Debug for StateSummary<'a>
source§impl<'a> Deref for StateSummary<'a>
impl<'a> Deref for StateSummary<'a>
source§impl<'a> DerefMut for StateSummary<'a>
impl<'a> DerefMut for StateSummary<'a>
source§impl<'de, 'a> Deserialize<'de> for StateSummary<'a>where
'de: 'a,
impl<'de, 'a> Deserialize<'de> for StateSummary<'a>where
'de: 'a,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<StateSummary<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<StateSummary<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> From<&'a [u8]> for StateSummary<'a>
impl<'a> From<&'a [u8]> for StateSummary<'a>
source§fn from(state: &'a [u8]) -> StateSummary<'a>
fn from(state: &'a [u8]) -> StateSummary<'a>
Converts to this type from the input type.
source§impl<'a> Serialize for StateSummary<'a>
impl<'a> Serialize for StateSummary<'a>
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl<'a> RefUnwindSafe for StateSummary<'a>
impl<'a> Send for StateSummary<'a>
impl<'a> Sync for StateSummary<'a>
impl<'a> Unpin for StateSummary<'a>
impl<'a> UnwindSafe for StateSummary<'a>
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
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> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
impl<T> Upcastable for Twhere
T: 'static + Any + Send + Sync,
§fn upcast_any_ref(&self) -> &(dyn Any + 'static)
fn upcast_any_ref(&self) -> &(dyn Any + 'static)
upcast ref
§fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)
upcast mut ref