pub struct MemoryRegistry;Expand description
MemoryRegistry
Canonical substrate registry for stable memory IDs.
Implementations§
Source§impl MemoryRegistry
impl MemoryRegistry
Sourcepub fn reserve_range(
crate_name: &str,
start: u8,
end: u8,
) -> Result<(), MemoryRegistryError>
pub fn reserve_range( crate_name: &str, start: u8, end: u8, ) -> Result<(), MemoryRegistryError>
Reserve an inclusive memory ID range for one crate.
Exact duplicate reservations by the same crate are accepted so init and post-upgrade can share the same bootstrap path.
Sourcepub fn register(
id: u8,
crate_name: &str,
label: &str,
) -> Result<(), MemoryRegistryError>
pub fn register( id: u8, crate_name: &str, label: &str, ) -> Result<(), MemoryRegistryError>
Register one memory ID under an existing owner range.
Sourcepub fn export() -> Vec<(u8, MemoryRegistryEntry)>
pub fn export() -> Vec<(u8, MemoryRegistryEntry)>
Export all registered entries (canonical snapshot).
Sourcepub fn export_ranges() -> Vec<(String, MemoryRange)>
pub fn export_ranges() -> Vec<(String, MemoryRange)>
Export all reserved ranges.
Sourcepub fn export_range_entries() -> Vec<MemoryRangeEntry>
pub fn export_range_entries() -> Vec<MemoryRangeEntry>
Export all reserved ranges with explicit owners.
Sourcepub fn export_ids_by_range() -> Vec<MemoryRangeSnapshot>
pub fn export_ids_by_range() -> Vec<MemoryRangeSnapshot>
Export registry entries grouped by reserved range.
Sourcepub fn get(id: u8) -> Option<MemoryRegistryEntry>
pub fn get(id: u8) -> Option<MemoryRegistryEntry>
Retrieve a single registry entry.
Auto Trait Implementations§
impl Freeze for MemoryRegistry
impl RefUnwindSafe for MemoryRegistry
impl Send for MemoryRegistry
impl Sync for MemoryRegistry
impl Unpin for MemoryRegistry
impl UnsafeUnpin for MemoryRegistry
impl UnwindSafe for MemoryRegistry
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