pub struct StorageValue { /* private fields */ }
Expand description
A serialized value suitable for storing. Internally uses an Arc<Vec<u8>>
for cheap cloning.
Implementations§
Source§impl StorageValue
impl StorageValue
Sourcepub fn new<V, VC>(value: &V, codec: &VC) -> Selfwhere
VC: StateValueCodec<V>,
pub fn new<V, VC>(value: &V, codec: &VC) -> Selfwhere
VC: StateValueCodec<V>,
Create a new storage value by serializing the input with the given codec.
Sourcepub fn into_cache_value(self) -> CacheValue
pub fn into_cache_value(self) -> CacheValue
Convert this value into a CacheValue
.
Trait Implementations§
Source§impl BorshDeserialize for StorageValue
impl BorshDeserialize for StorageValue
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for StorageValue
impl BorshSerialize for StorageValue
Source§impl Clone for StorageValue
impl Clone for StorageValue
Source§fn clone(&self) -> StorageValue
fn clone(&self) -> StorageValue
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 Debug for StorageValue
impl Debug for StorageValue
Source§impl Default for StorageValue
impl Default for StorageValue
Source§fn default() -> StorageValue
fn default() -> StorageValue
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for StorageValue
impl<'de> Deserialize<'de> for StorageValue
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 From<&str> for StorageValue
impl From<&str> for StorageValue
Source§impl From<CacheValue> for StorageValue
impl From<CacheValue> for StorageValue
Source§fn from(cache_value: CacheValue) -> Self
fn from(cache_value: CacheValue) -> Self
Converts to this type from the input type.
Source§impl PartialEq for StorageValue
impl PartialEq for StorageValue
Source§impl Serialize for StorageValue
impl Serialize for StorageValue
impl Eq for StorageValue
impl StructuralPartialEq for StorageValue
Auto Trait Implementations§
impl Freeze for StorageValue
impl RefUnwindSafe for StorageValue
impl Send for StorageValue
impl Sync for StorageValue
impl Unpin for StorageValue
impl UnwindSafe for StorageValue
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
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>
Converts
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>
Converts
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