Enum StoredValue

Source
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 is_unit_cl_value(&self) -> bool

Is the stored value a unit value.

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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 StructuralPartialEq for StoredValue

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where T: for<'de> Deserialize<'de>,