Ref

Struct Ref 

Source
pub struct Ref<'a, T>
where T: ManagedVecItem,
{ /* private fields */ }
Expand description

A reference to a type that implements ManagedVecItem.

Primarily used for preventing any mutability.

The names Ref and ManagedVecRef are interchangeable.

Implementations§

Source§

impl<T> Ref<'_, T>
where T: ManagedVecItem,

Source

pub unsafe fn new(item: T) -> Self

Creates a new ManagedVecRef instance.

§Safety

The ManagedVecRef object might not drop its content, effectively leading to a leak.

Trait Implementations§

Source§

impl<T> AsRef<T> for Ref<'_, T>
where T: ManagedVecItem,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Borrow<T> for Ref<'_, T>
where T: ManagedVecItem,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> Debug for Ref<'_, T>
where T: ManagedVecItem + Debug,

Source§

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

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

impl<T> Deref for Ref<'_, T>
where T: ManagedVecItem,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Drop for Ref<'_, T>
where T: ManagedVecItem,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T1, T2> PartialEq<Ref<'_, T2>> for Ref<'_, T1>

Source§

fn eq(&self, other: &Ref<'_, T2>) -> 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<Env> TxPayment<Env> for Ref<'_, Payment<Env::Api>>
where Env: TxEnv,

Source§

fn is_no_payment(&self, _env: &Env) -> bool

Returns true if payment indicates transfer of either non-zero EGLD or ESDT amounts.
Source§

fn perform_transfer_execute_fallible( self, env: &Env, to: &ManagedAddress<Env::Api>, gas_limit: u64, fc: FunctionCall<Env::Api>, ) -> Result<(), TransferExecuteFailed>

Transfer-execute calls have different APIs for different payments types. This method selects between them.
Source§

fn perform_transfer_execute_legacy( self, env: &Env, to: &ManagedAddress<Env::Api>, gas_limit: u64, fc: FunctionCall<Env::Api>, )

Allows transfer-execute without payment.
Source§

fn with_normalized<From, To, F, R>( self, env: &Env, from: &From, to: To, fc: FunctionCall<Env::Api>, f: F, ) -> R
where From: TxFrom<Env>, To: TxToSpecified<Env>, F: FnOnce(&ManagedAddress<Env::Api>, &BigUint<Env::Api>, FunctionCall<Env::Api>) -> R,

Converts an ESDT call to a built-in function call, if necessary.
Source§

fn into_full_payment_data(self, env: &Env) -> FullPaymentData<Env::Api>

Payment data to be used by the testing framework. Will be refactored.
Source§

fn perform_transfer_fallible( self, env: &Env, to: &ManagedAddress<Env::Api>, ) -> Result<(), TransferExecuteFailed>

Shortcut for doing direct transfers. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for Ref<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for Ref<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Ref<'a, T>
where T: Sync + Send,

§

impl<'a, T> Sync for Ref<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Ref<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for Ref<'a, T>

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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<Env, P> TxPayment<Env> for P
where Env: TxEnv, P: AsRef<ManagedVec<<Env as TxEnv>::Api, Payment<<Env as TxEnv>::Api>>>,

Source§

fn is_no_payment(&self, _env: &Env) -> bool

Returns true if payment indicates transfer of either non-zero EGLD or ESDT amounts.
Source§

fn perform_transfer_execute_fallible( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>

Transfer-execute calls have different APIs for different payments types. This method selects between them.
Source§

fn perform_transfer_execute_legacy( self, env: &Env, to: &ManagedAddress<<Env as TxEnv>::Api>, gas_limit: u64, fc: FunctionCall<<Env as TxEnv>::Api>, )

Allows transfer-execute without payment.
Source§

fn with_normalized<From, To, F, R>( self, env: &Env, from: &From, to: To, fc: FunctionCall<<Env as TxEnv>::Api>, f: F, ) -> R
where From: TxFrom<Env>, To: TxToSpecified<Env>, F: FnOnce(&ManagedAddress<<Env as TxEnv>::Api>, &BigUint<<Env as TxEnv>::Api>, FunctionCall<<Env as TxEnv>::Api>) -> R,

Converts an ESDT call to a built-in function call, if necessary.
Source§

fn into_full_payment_data( self, env: &Env, ) -> FullPaymentData<<Env as TxEnv>::Api>

Payment data to be used by the testing framework. Will be refactored.
Source§

fn perform_transfer_fallible( self, env: &Env, to: &ManagedAddress<Env::Api>, ) -> Result<(), TransferExecuteFailed>

Shortcut for doing direct transfers. Read more