#[macro_export]
macro_rules! ic_memory {
($label:path, $id:expr) => {{
if cfg!(target_arch = "wasm32") {
$crate::runtime::assert_memory_bootstrap_ready(stringify!($label), $id);
}
let _type_check: Option<$label> = None;
$crate::registry::defer_register($id, env!("CARGO_PKG_NAME"), stringify!($label))
.expect("memory id registration validation failed");
$crate::runtime::registry::MemoryRegistryRuntime::commit_pending_if_initialized()
.expect("late memory id registration commit failed");
$crate::manager::MEMORY_MANAGER
.with_borrow_mut(|mgr| mgr.get($crate::cdk::structures::memory::MemoryId::new($id)))
}};
}
#[macro_export]
macro_rules! ic_memory_range {
($start:expr, $end:expr) => {{
$crate::registry::defer_reserve_range(env!("CARGO_PKG_NAME"), $start, $end)
.expect("memory range reservation validation failed");
$crate::runtime::registry::MemoryRegistryRuntime::commit_pending_if_initialized()
.expect("late memory range registration commit failed");
}};
}