Enum StoredValue

Source
pub enum StoredValue {
Show 21 variants CLValue(CLValue), Account(Account), ContractWasm(ContractWasm), Contract(Contract), ContractPackage(ContractPackage), Transfer(TransferV1), DeployInfo(DeployInfo), EraInfo(EraInfo), Bid(Box<Bid>), Withdraw(Vec<WithdrawPurse>), Unbonding(Vec<UnbondingPurse>), AddressableEntity(AddressableEntity), BidKind(BidKind), SmartContract(Package), ByteCode(ByteCode), MessageTopic(MessageTopicSummary), Message(MessageChecksum), NamedKey(NamedKeyValue), Prepayment(PrepaymentKind), EntryPoint(EntryPointValue), RawBytes(Vec<u8>),
}
Expand description

A value stored in Global State.

Variants§

§

CLValue(CLValue)

A CLValue.

§

Account(Account)

An account.

§

ContractWasm(ContractWasm)

Contract wasm.

§

Contract(Contract)

A contract.

§

ContractPackage(ContractPackage)

A contract package.

§

Transfer(TransferV1)

A version 1 transfer.

§

DeployInfo(DeployInfo)

Info about a deploy.

§

EraInfo(EraInfo)

Info about an era.

§

Bid(Box<Bid>)

Variant that stores Bid.

§

Withdraw(Vec<WithdrawPurse>)

Variant that stores withdraw information.

§

Unbonding(Vec<UnbondingPurse>)

Unbonding information.

§

AddressableEntity(AddressableEntity)

An AddressableEntity.

§

BidKind(BidKind)

Variant that stores BidKind.

§

SmartContract(Package)

A smart contract Package.

§

ByteCode(ByteCode)

A record of byte code.

§

MessageTopic(MessageTopicSummary)

Variant that stores a message topic.

§

Message(MessageChecksum)

Variant that stores a message digest.

§

NamedKey(NamedKeyValue)

A NamedKey record.

§

Prepayment(PrepaymentKind)

A prepayment record.

§

EntryPoint(EntryPointValue)

An entrypoint record.

§

RawBytes(Vec<u8>)

Raw bytes. Similar to a crate::StoredValue::CLValue but does not incur overhead of a crate::CLValue and crate::CLType.

Implementations§

Source§

impl StoredValue

Source

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

Returns a reference to the wrapped CLValue if this is a CLValue variant.

Source

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

Returns a reference to the wrapped Account if this is an Account variant.

Source

pub fn as_byte_code(&self) -> Option<&ByteCode>

Returns a reference to the wrapped ByteCode if this is a ByteCode variant.

Source

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

Source

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

Returns a reference to the wrapped Contract if this is a Contract variant.

Source

pub fn as_package(&self) -> Option<&Package>

Returns a reference to the wrapped Package if this is a Package variant.

Source

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

Returns a reference to the wrapped ContractPackage if this is a ContractPackage variant.

Source

pub fn as_transfer(&self) -> Option<&TransferV1>

Returns a reference to the wrapped TransferV1 if this is a Transfer variant.

Source

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

Returns a reference to the wrapped DeployInfo if this is a DeployInfo variant.

Source

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

Returns a reference to the wrapped EraInfo if this is an EraInfo variant.

Source

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

Returns a reference to the wrapped Bid if this is a Bid variant.

Source

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

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

Source

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

Returns a reference to the wrapped list of UnbondingPurses if this is an Unbonding variant.

Source

pub fn as_unbond(&self) -> Option<&Unbond>

Returns a reference to the wrapped list of UnbondingPurses if this is an Unbonding variant.

Source

pub fn as_addressable_entity(&self) -> Option<&AddressableEntity>

Returns a reference to the wrapped AddressableEntity if this is an AddressableEntity variant.

Source

pub fn as_message_topic_summary(&self) -> Option<&MessageTopicSummary>

Returns a reference to the wrapped MessageTopicSummary if this is a MessageTopic variant.

Source

pub fn as_message_checksum(&self) -> Option<&MessageChecksum>

Returns a reference to the wrapped MessageChecksum if this is a Message variant.

Source

pub fn as_bid_kind(&self) -> Option<&BidKind>

Returns a reference to the wrapped BidKind if this is a BidKind variant.

Source

pub fn as_raw_bytes(&self) -> Option<&[u8]>

Returns raw bytes if this is a RawBytes variant.

Source

pub fn as_entry_point_value(&self) -> Option<&EntryPointValue>

Returns a reference to the wrapped EntryPointValue if this is a EntryPointValue variant.

Source

pub fn into_cl_value(self) -> Option<CLValue>

Returns the CLValue if this is a CLValue variant.

Source

pub fn into_account(self) -> Option<Account>

Returns the Account if this is an Account variant.

Source

pub fn into_contract_wasm(self) -> Option<ContractWasm>

Returns the ContractWasm if this is a ContractWasm variant.

Source

pub fn into_contract(self) -> Option<Contract>

Returns the Contract if this is a Contract variant.

Source

pub fn into_contract_package(self) -> Option<ContractPackage>

Returns the ContractPackage if this is a ContractPackage variant.

Source

pub fn into_package(self) -> Option<Package>

Returns the Package if this is a Package variant.

Source

pub fn into_legacy_transfer(self) -> Option<TransferV1>

Returns the TransferV1 if this is a Transfer variant.

Source

pub fn into_deploy_info(self) -> Option<DeployInfo>

Returns the DeployInfo if this is a DeployInfo variant.

Source

pub fn into_era_info(self) -> Option<EraInfo>

Returns the EraInfo if this is an EraInfo variant.

Source

pub fn into_bid(self) -> Option<Bid>

Returns the Bid if this is a Bid variant.

Source

pub fn into_withdraw(self) -> Option<Vec<WithdrawPurse>>

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

Source

pub fn into_unbonding(self) -> Option<Vec<UnbondingPurse>>

Returns the list of UnbondingPurses if this is an Unbonding variant.

Source

pub fn into_addressable_entity(self) -> Option<AddressableEntity>

Returns the AddressableEntity if this is an AddressableEntity variant.

Source

pub fn into_bid_kind(self) -> Option<BidKind>

Returns the BidKind if this is a BidKind variant.

Source

pub fn into_entry_point_value(self) -> Option<EntryPointValue>

Returns the EntryPointValue if this is a EntryPointValue 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

Source

pub fn tag(&self) -> StoredValueTag

Returns the tag of the StoredValue.

Source

pub fn into_byte_code(self) -> Option<ByteCode>

Returns the serialized length of the StoredValue.

Source

pub fn into_named_key(self) -> Option<NamedKeyValue>

Returns the serialized length of the StoredValue.

Trait Implementations§

Source§

impl Clone for StoredValue

Source§

fn clone(&self) -> StoredValue

Returns a duplicate 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 DataSize for StoredValue

Source§

const IS_DYNAMIC: bool = true

If true, the type has a heap size that can vary at runtime, depending on the actual value.
Source§

const STATIC_HEAP_SIZE: usize = 0usize

The amount of space a value of the type always occupies. If 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

Estimates the size of heap memory taken up by this value. 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<AddressableEntity> for StoredValue

Source§

fn from(value: AddressableEntity) -> 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<BidKind> for StoredValue

Source§

fn from(bid_kind: BidKind) -> StoredValue

Converts to this type from the input type.
Source§

impl From<ByteCode> for StoredValue

Source§

fn from(value: ByteCode) -> 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) -> Self

Converts to this type from the input type.
Source§

impl From<ContractPackage> for StoredValue

Source§

fn from(value: ContractPackage) -> Self

Converts to this type from the input type.
Source§

impl From<ContractWasm> for StoredValue

Source§

fn from(value: ContractWasm) -> Self

Converts to this type from the input type.
Source§

impl From<EntryPointValue> for StoredValue

Source§

fn from(value: EntryPointValue) -> Self

Converts to this type from the input type.
Source§

impl From<Package> for StoredValue

Source§

fn from(value: Package) -> StoredValue

Converts to this type from the input type.
Source§

impl From<StoredValue> for TransformInstruction

Source§

fn from(value: StoredValue) -> Self

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

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
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 AddressableEntity

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 Bid

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 BidKind

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 ByteCode

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(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 NamedKeyValue

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 Package

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 TransferV1

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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