frappe 0.4.7

Functional Reactive Programming library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Internal helper functions.

use std::sync::{self as arc, Arc};

pub fn arc_and_weak<T>(val: T) -> (Arc<T>, arc::Weak<T>) {
    let rc = Arc::new(val);
    let weak = Arc::downgrade(&rc);
    (rc, weak)
}

macro_rules! with_weak {
    ($weak:expr, $f:expr) => {
        $weak.upgrade().map($f).is_some()
    };
}