pub enum Transform {
Identity,
Write(StoredValue),
AddInt32(i32),
AddUInt64(u64),
AddUInt128(U128),
AddUInt256(U256),
AddUInt512(U512),
AddKeys(NamedKeys),
Failure(Error),
}
Expand description
Representation of a single transformation ocurring during execution.
Note that all arithmetic variants of Transform
are commutative which means that a given
collection of them can be executed in any order to produce the same end result.
Variants§
Identity
An identity transformation that does not modify a value in the global state.
Created as part of a read from the global state.
Write(StoredValue)
Writes a new value in the global state.
AddInt32(i32)
A wrapping addition of an i32
to an existing numeric value (not necessarily an i32
) in
the global state.
AddUInt64(u64)
A wrapping addition of a u64
to an existing numeric value (not necessarily an u64
) in
the global state.
AddUInt128(U128)
A wrapping addition of a U128
to an existing numeric value (not necessarily an U128
) in
the global state.
AddUInt256(U256)
A wrapping addition of a U256
to an existing numeric value (not necessarily an U256
) in
the global state.
AddUInt512(U512)
A wrapping addition of a U512
to an existing numeric value (not necessarily an U512
) in
the global state.
AddKeys(NamedKeys)
Adds new named keys to an existing entry in the global state.
This transform assumes that the existing stored value is either an Account or a Contract.
Failure(Error)
Represents the case where applying a transform would cause an error.
Implementations§
source§impl Transform
impl Transform
sourcepub fn apply(self, stored_value: StoredValue) -> Result<StoredValue, Error>
pub fn apply(self, stored_value: StoredValue) -> Result<StoredValue, Error>
Applies the transformation on a specified stored value instance.
This method produces a new StoredValue
instance based on the Transform
variant.
Trait Implementations§
source§impl AddAssign for Transform
impl AddAssign for Transform
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl DataSize for Transformwhere
StoredValue: DataSize,
i32: DataSize,
u64: DataSize,
U128: DataSize,
U256: DataSize,
U512: DataSize,
NamedKeys: DataSize,
impl DataSize for Transformwhere StoredValue: DataSize, i32: DataSize, u64: DataSize, U128: DataSize, U256: DataSize, U512: DataSize, NamedKeys: DataSize,
source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true
, the type has a heap size that can vary at runtime, depending on the actual value.source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
source§impl From<StoredValue> for Transform
impl From<StoredValue> for Transform
source§fn from(x: StoredValue) -> Self
fn from(x: StoredValue) -> Self
source§impl PartialEq for Transform
impl PartialEq for Transform
source§impl TryFrom<Transform> for StoredValue
impl TryFrom<Transform> for StoredValue
impl Eq for Transform
impl StructuralEq for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnwindSafe for Transform
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.