multiversx_sc::storage::mappers

Struct AddressToIdMapper

source
pub struct AddressToIdMapper<SA, A = CurrentStorage>
where SA: StorageMapperApi, A: StorageAddress<SA>,
{ /* private fields */ }

Implementations§

source§

impl<SA, A> AddressToIdMapper<SA, A>
where SA: StorageMapperApi, A: StorageAddress<SA>,

source

pub fn contains_id(&self, id: AddressId) -> bool

source

pub fn get_id(&self, address: &ManagedAddress<SA>) -> AddressId

source

pub fn get_id_non_zero(&self, address: &ManagedAddress<SA>) -> AddressId

source

pub fn get_address(&self, id: AddressId) -> Option<ManagedAddress<SA>>

source

pub fn get_last_id(&self) -> AddressId

source§

impl<SA> AddressToIdMapper<SA, CurrentStorage>
where SA: StorageMapperApi,

source

pub fn get_id_or_insert(&self, address: &ManagedAddress<SA>) -> AddressId

source

pub fn insert_new(&self, address: &ManagedAddress<SA>) -> AddressId

source

pub fn remove_by_id(&self, id: AddressId) -> Option<ManagedAddress<SA>>

source

pub fn remove_by_address(&self, address: &ManagedAddress<SA>) -> AddressId

Trait Implementations§

source§

impl<SA> StorageMapper<SA> for AddressToIdMapper<SA>
where SA: StorageMapperApi,

source§

fn new(base_key: StorageKey<SA>) -> Self

Will be called automatically by the #[storage_mapper] annotation generated code.
source§

impl<SA> StorageMapperFromAddress<SA> for AddressToIdMapper<SA, ManagedAddress<SA>>
where SA: StorageMapperApi,

source§

fn new_from_address( address: ManagedAddress<SA>, base_key: StorageKey<SA>, ) -> Self

Will be called automatically by the #[storage_mapper_from_address] annotation generated code.

Auto Trait Implementations§

§

impl<SA, A> Freeze for AddressToIdMapper<SA, A>

§

impl<SA, A> RefUnwindSafe for AddressToIdMapper<SA, A>

§

impl<SA, A> Send for AddressToIdMapper<SA, A>
where A: Send, SA: Send, <SA as HandleTypeInfo>::ManagedBufferHandle: Send,

§

impl<SA, A> Sync for AddressToIdMapper<SA, A>
where A: Sync, SA: Sync, <SA as HandleTypeInfo>::ManagedBufferHandle: Sync,

§

impl<SA, A> Unpin for AddressToIdMapper<SA, A>

§

impl<SA, A> UnwindSafe for AddressToIdMapper<SA, 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> 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, 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.