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) -> Ref<'_, T>

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<(), Error>

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) -> &<Ref<'_, T> as Deref>::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§

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 as TxEnv>::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 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 as TxEnv>::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: Send + Sync,

§

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§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

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> InterpretableFrom<T> for T

Source§

fn interpret_from(from: T, _context: &InterpreterContext) -> T

§

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

§

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

§

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> ReconstructableFrom<T> for T

Source§

fn reconstruct_from(from: T, _builder: &ReconstructorContext) -> T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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 as TxEnv>::Api>, ) -> Result<(), TransferExecuteFailed>

Shortcut for doing direct transfers. Read more
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