floem 0.2.0

A native Rust UI library with fine-grained reactivity
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::sync::atomic::AtomicU64;

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct Id(u64);

impl Id {
    /// Allocate a new, unique `Id`.
    pub fn next() -> Id {
        static TIMER_COUNTER: AtomicU64 = AtomicU64::new(0);
        Id(TIMER_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed))
    }

    pub fn to_raw(self) -> u64 {
        self.0
    }
}

pub type EditorId = Id;