pub struct StateSummary<'a>(/* private fields */);
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<'_>
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Extracts the owned data as a Vec<u8>
.
pub fn into_owned(self) -> StateSummary<'static>
pub fn deser_state_summary<'de, D>(
deser: D,
) -> Result<StateSummary<'static>, D::Error>where
D: Deserializer<'de>,
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 AsRef<[u8]> for StateSummary<'_>
impl AsRef<[u8]> for StateSummary<'_>
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 duplicate 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 DerefMut for StateSummary<'_>
impl DerefMut for StateSummary<'_>
Source§impl<'de: 'a, 'a> Deserialize<'de> for StateSummary<'a>
impl<'de: 'a, 'a> Deserialize<'de> for StateSummary<'a>
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>,
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§impl<'a> PartialEq for StateSummary<'a>
impl<'a> PartialEq for StateSummary<'a>
Source§impl<'a> Serialize for StateSummary<'a>
impl<'a> Serialize for StateSummary<'a>
impl<'a> Eq for StateSummary<'a>
impl<'a> StructuralPartialEq for StateSummary<'a>
Auto Trait Implementations§
impl<'a> Freeze for StateSummary<'a>
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§
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
Mutably borrows from an owned value. Read more