Skip to main content

TestTokenId

Struct TestTokenId 

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

Encodes a dummy address, to be used for tests.

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

Implementations§

Source§

impl<'a> TestTokenId<'a>

Source

pub const EGLD_000000: TestTokenId<'static>

A constant representing the EGLD-000000 token identifier.

Source

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

Creates a new test token identifier from a string name.

Source

pub fn eval_to_expr(&self) -> String

Evaluates the test token identifier to a Mandos (scenario) expression string with the “str:” prefix.

Source

pub fn to_token_identifier<Api: ManagedTypeApi>( &self, ) -> EsdtTokenIdentifier<Api>

👎Deprecated since 0.65.0: Use to_esdt_token_identifier() instead

Incorrectly named method, kept for backward compatibility.

Use:

  • into/from for direct conversion to TokenId;
  • [to_token_id()] - to explicitly convert to TokenId;
  • [to_esdt_token_identifier()] - for ESDT-only scenarios, mostly legacy.
Source

pub fn to_esdt_token_identifier<Api: ManagedTypeApi>( &self, ) -> EsdtTokenIdentifier<Api>

Converts this test token identifier to an ESDT token identifier.

Use this for ESDT-only scenarios, mostly legacy code.

Source

pub fn to_token_id<Api: ManagedTypeApi>(&self) -> TokenId<Api>

Converts this test token identifier to a TokenId.

Source

pub fn as_str(&self) -> &str

Returns the token identifier name as a string slice.

Source

pub fn as_bytes(&self) -> &[u8]

Returns the token identifier name as a byte slice.

Trait Implementations§

Source§

impl<Env> AnnotatedValue<Env, EsdtTokenIdentifier<<Env as TxEnv>::Api>> for TestTokenId<'_>
where Env: TxEnv,

Source§

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

Source§

fn to_value(&self, _env: &Env) -> EsdtTokenIdentifier<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 TestTokenId<'a>

Source§

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

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

Source§

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

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

impl<M: ManagedTypeApi> From<TestTokenId<'_>> for TokenId<M>

Source§

fn from(test_token: TestTokenIdentifier<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'a, Api> From<TestTokenId<'a>> for EsdtTokenIdentifier<Api>
where Api: ManagedTypeApi,

Source§

fn from(value: TestTokenId<'a>) -> Self

Converts to this type from the input type.
Source§

impl NestedEncode for TestTokenId<'_>

Source§

fn dep_encode_or_handle_err<O, H>( &self, dest: &mut O, h: H, ) -> Result<(), H::HandledErr>

Version of dep_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 dep_encode<O>(&self, dest: &mut O) -> Result<(), EncodeError>

NestedEncode to output, using the format of an object nested inside another structure. Does not provide compact version.
Source§

impl<'a> PartialEq for TestTokenId<'a>

Source§

fn eq(&self, other: &TestTokenId<'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 TestTokenId<'_>

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 output.
Source§

impl<'a> Copy for TestTokenId<'a>

Source§

impl<'a> Eq for TestTokenId<'a>

Source§

impl<'a> StructuralPartialEq for TestTokenId<'a>

Source§

impl<M> TypeAbiFrom<&TestTokenId<'_>> for EgldOrEsdtTokenIdentifier<M>
where M: ManagedTypeApi,

Source§

impl<M> TypeAbiFrom<&TestTokenId<'_>> for TokenId<M>
where M: ManagedTypeApi,

Source§

impl<M> TypeAbiFrom<TestTokenId<'_>> for EgldOrEsdtTokenIdentifier<M>
where M: ManagedTypeApi,

Source§

impl<Api> TypeAbiFrom<TestTokenId<'_>> for EsdtTokenIdentifier<Api>
where Api: ManagedTypeApi,

Source§

impl<M> TypeAbiFrom<TestTokenId<'_>> for TokenId<M>
where M: ManagedTypeApi,

Auto Trait Implementations§

§

impl<'a> Freeze for TestTokenId<'a>

§

impl<'a> RefUnwindSafe for TestTokenId<'a>

§

impl<'a> Send for TestTokenId<'a>

§

impl<'a> Sync for TestTokenId<'a>

§

impl<'a> Unpin for TestTokenId<'a>

§

impl<'a> UnsafeUnpin for TestTokenId<'a>

§

impl<'a> UnwindSafe for TestTokenId<'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, 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> 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> 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> 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 output.
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,

Source§

impl<T, U> TypeAbiFrom<TypeAbiUniversalInput<T>> for U