fieldx 0.2.3

Procedural macro for constructing structs with lazily initialized fields, builder pattern, and serde support with a focus on declarative syntax.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![cfg(all(feature = "async", feature = "clonable-lock"))]
use fieldx::r#async::FXRwLock;

#[tokio::test]
async fn rwlock() {
    let rwlock = FXRwLock::new("initial".to_string());

    assert_eq!(*rwlock.read().await, "initial");

    {
        *rwlock.write().await = "new".to_string();
    }
    assert_eq!(*rwlock.read().await, "new");
}