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>,
impl<SA, A> AddressToIdMapper<SA, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
pub fn contains_id(&self, id: u64) -> bool
pub fn get_id(&self, address: &ManagedAddress<SA>) -> u64
pub fn get_id_non_zero(&self, address: &ManagedAddress<SA>) -> u64
pub fn get_address(&self, id: u64) -> Option<ManagedAddress<SA>>
pub fn get_last_id(&self) -> u64
Source§impl<SA> AddressToIdMapper<SA>where
SA: StorageMapperApi,
impl<SA> AddressToIdMapper<SA>where
SA: StorageMapperApi,
pub fn get_id_or_insert(&self, address: &ManagedAddress<SA>) -> u64
pub fn insert_new(&self, address: &ManagedAddress<SA>) -> u64
pub fn remove_by_id(&self, id: u64) -> Option<ManagedAddress<SA>>
pub fn remove_by_address(&self, address: &ManagedAddress<SA>) -> u64
Trait Implementations§
Source§impl<SA> StorageMapper<SA> for AddressToIdMapper<SA>where
SA: StorageMapperApi,
impl<SA> StorageMapper<SA> for AddressToIdMapper<SA>where
SA: StorageMapperApi,
Source§fn new(base_key: StorageKey<SA>) -> AddressToIdMapper<SA>
fn new(base_key: StorageKey<SA>) -> AddressToIdMapper<SA>
Will be called automatically by the
#[storage_mapper]
annotation generated code.Source§impl<SA> StorageMapperFromAddress<SA> for AddressToIdMapper<SA, ManagedAddress<SA>>where
SA: StorageMapperApi,
impl<SA> StorageMapperFromAddress<SA> for AddressToIdMapper<SA, ManagedAddress<SA>>where
SA: StorageMapperApi,
Source§fn new_from_address(
address: ManagedAddress<SA>,
base_key: StorageKey<SA>,
) -> AddressToIdMapper<SA, ManagedAddress<SA>>
fn new_from_address( address: ManagedAddress<SA>, base_key: StorageKey<SA>, ) -> AddressToIdMapper<SA, ManagedAddress<SA>>
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>where
A: RefUnwindSafe,
SA: RefUnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: RefUnwindSafe,
impl<SA, A> Send for AddressToIdMapper<SA, A>
impl<SA, A> Sync for AddressToIdMapper<SA, A>
impl<SA, A> Unpin for AddressToIdMapper<SA, A>
impl<SA, A> UnwindSafe for AddressToIdMapper<SA, A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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