multiversx_sc/storage/mappers/mapper.rs
1use crate::{api::StorageMapperApi, storage::StorageKey, types::ManagedAddress};
2pub trait StorageMapper<SA>: 'static
3where
4 SA: StorageMapperApi,
5{
6 /// Will be called automatically by the `#[storage_mapper]` annotation generated code.
7 fn new(base_key: StorageKey<SA>) -> Self;
8}
9
10pub trait StorageMapperFromAddress<SA>: 'static
11where
12 SA: StorageMapperApi,
13{
14 /// Will be called automatically by the `#[storage_mapper_from_address]`
15 /// annotation generated code.
16 fn new_from_address(address: ManagedAddress<SA>, base_key: StorageKey<SA>) -> Self;
17}
18
19pub trait StorageClearable {
20 /// Clears all the entries owned by the storage.
21 fn clear(&mut self);
22}