1#![deny(missing_docs)]
3extern crate crossbeam;
4extern crate mio;
5
6#[macro_use]
7extern crate log;
8
9use std::fmt;
10use std::sync::atomic::{AtomicU32, Ordering};
11
12pub mod channel;
13pub mod poll;
14pub mod queue;
15pub mod scheduler;
16
17static NEXT_NOTIFICATION_ID: AtomicU32 = AtomicU32::new(1);
18
19#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
21pub struct NotificationId(u32);
22
23impl NotificationId {
24 pub fn gen_next() -> NotificationId {
26 let id = NEXT_NOTIFICATION_ID.fetch_add(1, Ordering::SeqCst);
27 NotificationId(id)
28 }
29
30 pub fn id(&self) -> u32 {
32 self.0
33 }
34}
35
36impl fmt::Display for NotificationId {
37 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38 write!(f, "{}", self.0)
39 }
40}