canic_core/
memory_macros.rs1#[macro_export]
6macro_rules! ic_memory_key {
7 ($stable_key:literal, $label:path, $id:expr) => {{
8 $crate::memory::runtime::assert_memory_bootstrap_ready(stringify!($label), $id);
9 $crate::__reexports::ic_memory::ic_memory_key!($stable_key, $label, $id)
10 }};
11}
12
13#[macro_export]
15macro_rules! ic_memory_range {
16 (start = $start:expr, end = $end:expr $(,)?) => {
17 $crate::__reexports::ic_memory::ic_memory_range!(start = $start, end = $end,);
18 };
19 (start = $start:expr, end = $end:expr, mode = $mode:ident $(,)?) => {
20 $crate::__reexports::ic_memory::ic_memory_range!(start = $start, end = $end, mode = $mode,);
21 };
22}
23
24#[macro_export]
26macro_rules! eager_init {
27 ($body:block) => {
28 $crate::__reexports::ic_memory::eager_init!($body);
29 };
30}
31
32#[macro_export]
34macro_rules! eager_static {
35 ($vis:vis static $name:ident : $ty:ty = $init:expr;) => {
36 thread_local! {
37 $vis static $name: $ty = $init;
38 }
39
40 const _: () = {
41 fn __canic_touch_tls() {
42 $name.with(|_| {});
43 }
44
45 #[ $crate::__reexports::ctor::ctor(unsafe, anonymous, crate_path = $crate::__reexports::ctor) ]
46 fn __canic_register_eager_tls() {
47 $crate::memory::runtime::defer_tls_initializer(__canic_touch_tls);
48 }
49 };
50 };
51}