std_macro_extensions/rw_lock/
macro.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/// Creates a new `RwLock` instance.
///
/// This macro takes a value and wraps it in an `RwLock`, providing thread-safe access with multiple readers or a single writer.
/// `RwLock` allows multiple immutable borrows or one mutable borrow at a time, enforcing read-write access at the runtime level.
///
/// # Examples
/// ```
/// use std_macro_extensions::*;
/// let my_rwlock = rw_lock!(5);
/// ```
#[macro_export]
macro_rules! rw_lock {
    ($val:expr) => {
        std::sync::RwLock::new($val)
    };
}