pub enum StoredValue {
    CLValue(CLValue),
    Account(Account),
    ContractWasm(ContractWasm),
    Contract(Contract),
    ContractPackage(ContractPackage),
    Transfer(Transfer),
    DeployInfo(DeployInfo),
    EraInfo(EraInfo),
    Bid(Box<Bid>),
    Withdraw(Vec<WithdrawPurse>),
    Unbonding(Vec<UnbondingPurse>),
}
Expand description

StoredValue represents all possible variants of values stored in Global State.

Variants§

§

CLValue(CLValue)

Variant that stores CLValue.

§

Account(Account)

Variant that stores Account.

§

ContractWasm(ContractWasm)

Variant that stores ContractWasm.

§

Contract(Contract)

Variant that stores Contract.

§

ContractPackage(ContractPackage)

Variant that stores ContractPackage.

§

Transfer(Transfer)

Variant that stores Transfer.

§

DeployInfo(DeployInfo)

Variant that stores DeployInfo.

§

EraInfo(EraInfo)

Variant that stores EraInfo.

§

Bid(Box<Bid>)

Variant that stores Bid.

§

Withdraw(Vec<WithdrawPurse>)

Variant that stores withdraw information.

§

Unbonding(Vec<UnbondingPurse>)

Variant that stores unbonding information.

Implementations§

source§

impl StoredValue

source

pub fn as_cl_value(&self) -> Option<&CLValue>

Returns a wrapped CLValue if this is a CLValue variant.

source

pub fn as_account(&self) -> Option<&Account>

Returns a wrapped Account if this is an Account variant.

source

pub fn as_contract(&self) -> Option<&Contract>

Returns a wrapped Contract if this is a Contract variant.

source

pub fn as_contract_wasm(&self) -> Option<&ContractWasm>

Returns a wrapped ContractWasm if this is a ContractWasm variant.

source

pub fn as_contract_package(&self) -> Option<&ContractPackage>

Returns a wrapped ContractPackage if this is a ContractPackage variant.

source

pub fn as_deploy_info(&self) -> Option<&DeployInfo>

Returns a wrapped DeployInfo if this is a DeployInfo variant.

source

pub fn as_era_info(&self) -> Option<&EraInfo>

Returns a wrapped EraInfo if this is a EraInfo variant.

source

pub fn as_bid(&self) -> Option<&Bid>

Returns a wrapped Bid if this is a Bid variant.

source

pub fn as_withdraw(&self) -> Option<&Vec<WithdrawPurse>>

Returns a wrapped list of WithdrawPurses if this is a Withdraw variant.

source

pub fn as_unbonding(&self) -> Option<&Vec<UnbondingPurse>>

Returns a wrapped list of UnbondingPurses if this is a Unbonding variant.

source

pub fn type_name(&self) -> String

Returns the type name of the StoredValue enum variant.

For CLValue variants it will return the name of the CLType

Trait Implementations§

source§

impl Clone for StoredValue

source§

fn clone(&self) -> StoredValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StoredValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for StoredValue

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<Account> for StoredValue

source§

fn from(value: Account) -> StoredValue

Converts to this type from the input type.
source§

impl From<Bid> for StoredValue

source§

fn from(bid: Bid) -> StoredValue

Converts to this type from the input type.
source§

impl From<CLValue> for StoredValue

source§

fn from(value: CLValue) -> StoredValue

Converts to this type from the input type.
source§

impl From<Contract> for StoredValue

source§

fn from(value: Contract) -> StoredValue

Converts to this type from the input type.
source§

impl From<ContractPackage> for StoredValue

source§

fn from(value: ContractPackage) -> StoredValue

Converts to this type from the input type.
source§

impl From<ContractWasm> for StoredValue

source§

fn from(value: ContractWasm) -> StoredValue

Converts to this type from the input type.
source§

impl FromBytes for StoredValue

source§

fn from_bytes(bytes: &[u8]) -> Result<(Self, &[u8]), Error>

Deserializes the slice into Self.
source§

fn from_vec(bytes: Vec<u8>) -> Result<(Self, Vec<u8>), Error>

Deserializes the Vec<u8> into Self.
source§

impl PartialEq for StoredValue

source§

fn eq(&self, other: &StoredValue) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for StoredValue

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
source§

impl ToBytes for StoredValue

source§

fn to_bytes(&self) -> Result<Vec<u8>, Error>

Serializes &self to a Vec<u8>.
source§

fn serialized_length(&self) -> usize

Returns the length of the Vec<u8> which would be returned from a successful call to to_bytes() or into_bytes(). The data is not actually serialized, so this call is relatively cheap.
source§

fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>

Writes &self into a mutable writer.
source§

fn into_bytes(self) -> Result<Vec<u8>, Error>where Self: Sized,

Consumes self and serializes to a Vec<u8>.
source§

impl TryFrom<StoredValue> for Account

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for CLValue

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for Contract

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for ContractPackage

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for ContractWasm

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(stored_value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for DeployInfo

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for EraInfo

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<StoredValue> for Transfer

§

type Error = TypeMismatch

The type returned in the event of a conversion error.
source§

fn try_from(value: StoredValue) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Eq for StoredValue

source§

impl StructuralEq for StoredValue

source§

impl StructuralPartialEq for StoredValue

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,