#![deny(missing_docs)]
#[macro_use]
extern crate log;
use std::fmt;
use std::sync::atomic::{AtomicU32, Ordering};
pub mod channel;
pub mod poll;
pub mod queue;
pub mod scheduler;
static NEXT_NOTIFICATION_ID: AtomicU32 = AtomicU32::new(1);
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct NotificationId(u32);
impl NotificationId {
pub fn gen_next() -> NotificationId {
let id = NEXT_NOTIFICATION_ID.fetch_add(1, Ordering::SeqCst);
NotificationId(id)
}
pub fn id(&self) -> u32 {
self.0
}
}
impl fmt::Display for NotificationId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0)
}
}