std_macro_extensions/ref_cell/
macro.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Creates a new `RefCell` instance.
///
/// This macro takes a value and wraps it in a `RefCell`, providing interior mutability with dynamic borrow checking.
/// `RefCell` allows mutable access to its contents even when it is shared among multiple references.
///
/// # Examples
/// ```
/// use std_macro_extensions::*;
/// let my_refcell = refcell!(5);
/// ```
#[macro_export]
macro_rules! refcell {
    ($val:expr) => {
        std::cell::RefCell::new($val)
    };
}