multiversx_sc::types

Struct TestSCAddress

Source
pub struct TestSCAddress<'a> { /* private fields */ }
Expand description

Encodes a dummy SC address, to be used for tests.

It is designed to be usable from contracts (especiall test contracts), with a minimal footprint. For this reason, its inner structure is subject to change.

Implementations§

Source§

impl<'a> TestSCAddress<'a>

Source

pub const fn new(name: &'a str) -> Self

Source§

impl TestSCAddress<'_>

Source§

impl TestSCAddress<'_>

Source

pub fn eval_to_array(&self) -> [u8; 32]

Source

pub fn eval_to_expr(&self) -> String

Trait Implementations§

Source§

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

Source§

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

Source§

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

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

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

Consumes annotated value to produce actual value. Read more
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. Read more
Source§

impl<'a> Clone for TestSCAddress<'a>

Source§

fn clone(&self) -> TestSCAddress<'a>

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<'a> Debug for TestSCAddress<'a>

Source§

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

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

impl PartialEq<Address> for TestSCAddress<'_>

Source§

fn eq(&self, other: &Address) -> 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<Api: ManagedTypeApi> PartialEq<ManagedAddress<Api>> for TestSCAddress<'_>

Source§

fn eq(&self, other: &ManagedAddress<Api>) -> 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 PartialEq<TestAddress<'_>> for TestSCAddress<'_>

Source§

fn eq(&self, other: &TestAddress<'_>) -> 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 PartialEq<TestSCAddress<'_>> for TestAddress<'_>

Source§

fn eq(&self, other: &TestSCAddress<'_>) -> 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<'a> PartialEq<TestSCAddress<'a>> for Address

Source§

fn eq(&self, other: &TestSCAddress<'a>) -> 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<'a, Api: ManagedTypeApi> PartialEq<TestSCAddress<'a>> for ManagedAddress<Api>

Source§

fn eq(&self, other: &TestSCAddress<'a>) -> 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<'a> PartialEq for TestSCAddress<'a>

Source§

fn eq(&self, other: &TestSCAddress<'a>) -> 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 TopEncode for TestSCAddress<'_>

Source§

fn top_encode_or_handle_err<O, H>( &self, output: O, h: H, ) -> Result<(), H::HandledErr>

Version of top_encode that can handle errors as soon as they occur. For instance in can exit immediately and make sure that if it returns, it is a success. By not deferring error handling, this can lead to somewhat smaller bytecode.
Source§

fn top_encode<O>(&self, output: O) -> Result<(), EncodeError>
where O: TopEncodeOutput,

Attempt to serialize the value to ouput.
Source§

impl<Env> TxFrom<Env> for TestSCAddress<'_>
where Env: TxEnv,

Source§

impl<Env> TxToSpecified<Env> for TestSCAddress<'_>
where Env: TxEnv,

Source§

fn with_address_ref<F, R>(&self, env: &Env, f: F) -> R
where F: FnOnce(&ManagedAddress<Env::Api>) -> R,

Avoids a clone when performing transfer-execute. Read more
Source§

impl<'a> Copy for TestSCAddress<'a>

Source§

impl<'a> Eq for TestSCAddress<'a>

Source§

impl<'a> StructuralPartialEq for TestSCAddress<'a>

Source§

impl<Env> TxFromSpecified<Env> for TestSCAddress<'_>
where Env: TxEnv,

Source§

impl<Env> TxTo<Env> for TestSCAddress<'_>
where Env: TxEnv,

Source§

impl<Api> TypeAbiFrom<TestSCAddress<'_>> for ManagedAddress<Api>
where Api: ManagedTypeApi,

Auto Trait Implementations§

§

impl<'a> Freeze for TestSCAddress<'a>

§

impl<'a> RefUnwindSafe for TestSCAddress<'a>

§

impl<'a> Send for TestSCAddress<'a>

§

impl<'a> Sync for TestSCAddress<'a>

§

impl<'a> Unpin for TestSCAddress<'a>

§

impl<'a> UnwindSafe for TestSCAddress<'a>

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, dst: *mut u8)

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

Source§

fn fmt<F>(&self, f: &mut F)

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> TopEncodeMulti for T
where T: TopEncode,

Source§

fn multi_encode_or_handle_err<O, H>( &self, output: &mut O, h: H, ) -> Result<(), <H as EncodeErrorHandler>::HandledErr>

Version of top_encode that can handle errors as soon as they occur. For instance in can exit immediately and make sure that if it returns, it is a success. By not deferring error handling, this can lead to somewhat smaller bytecode.
Source§

fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>

Attempt to serialize the value to ouput.
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<O, T> ProxyArg<O> for T
where O: TypeAbiFrom<T>, T: TopEncodeMulti,