multiversx_sc::types

Trait AnnotatedValue

Source
pub trait AnnotatedValue<Env, T>: Sized
where Env: TxEnv,
{ // Required methods fn annotation(&self, env: &Env) -> ManagedBuffer<Env::Api>; fn to_value(&self, env: &Env) -> T; // Provided methods fn into_value(self, env: &Env) -> T { ... } fn with_value_ref<F, R>(&self, env: &Env, f: F) -> R where F: FnOnce(&T) -> R { ... } }
Expand description

Describes a value can also have a custom representation in a mandos scenario.

It is based on managed types in order to be embedded into parametric tests too.

Required Methods§

Source

fn annotation(&self, env: &Env) -> ManagedBuffer<Env::Api>

Source

fn to_value(&self, env: &Env) -> T

Produces the value from a reference of the annotated type. Might involve a .clone() in some cases.

Provided Methods§

Source

fn into_value(self, env: &Env) -> T

Consumes annotated value to produce actual value.

Override whenever it helps to avoid an unnecessary clone.

Source

fn with_value_ref<F, R>(&self, env: &Env, f: F) -> R
where F: FnOnce(&T) -> R,

Can be used when working with references only.

Override whenever it helps to avoid an unnecessary clone.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<Env> AnnotatedValue<Env, u64> for i32
where Env: TxEnv,

Source§

fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Source§

fn to_value(&self, _env: &Env) -> u64

Source§

impl<Env> AnnotatedValue<Env, u64> for u64
where Env: TxEnv,

Source§

fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Source§

fn to_value(&self, _env: &Env) -> u64

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for i32
where Env: TxEnv,

Source§

fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Source§

fn to_value(&self, _env: &Env) -> BigUint<Env::Api>

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for u64
where Env: TxEnv,

Source§

fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Source§

fn to_value(&self, _env: &Env) -> BigUint<Env::Api>

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for ()
where Env: TxEnv,

Source§

fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Source§

fn to_value(&self, _env: &Env) -> BigUint<Env::Api>

Source§

impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for ()
where Env: TxEnv,

Source§

fn annotation(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Source§

fn to_value(&self, _env: &Env) -> ManagedBuffer<Env::Api>

Implementors§

Source§

impl<Api> AnnotatedValue<TxScEnv<Api>, ManagedAddress<Api>> for ToCaller

Source§

impl<Api> AnnotatedValue<TxScEnv<Api>, ManagedAddress<Api>> for ToSelf

Source§

impl<Env> AnnotatedValue<Env, u64> for GasLeft
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for &BigUint<Env::Api>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for BigUint<Env::Api>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for ManagedRef<'_, Env::Api, BigUint<Env::Api>>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for NotPayable
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for &Address
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for &ManagedAddress<Env::Api>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for Address
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for ESDTSystemSCAddress
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for ManagedAddress<Env::Api>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for TestAddress<'_>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedAddress<<Env as TxEnv>::Api>> for TestSCAddress<'_>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, ManagedBuffer<<Env as TxEnv>::Api>> for ManagedBuffer<Env::Api>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, TokenIdentifier<<Env as TxEnv>::Api>> for &TokenIdentifier<Env::Api>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, TokenIdentifier<<Env as TxEnv>::Api>> for TestTokenIdentifier<'_>
where Env: TxEnv,

Source§

impl<Env> AnnotatedValue<Env, TokenIdentifier<<Env as TxEnv>::Api>> for TokenIdentifier<Env::Api>
where Env: TxEnv,

Source§

impl<Env, EgldValue> AnnotatedValue<Env, BigUint<<Env as TxEnv>::Api>> for Egld<EgldValue>
where Env: TxEnv, EgldValue: TxEgldValue<Env>,