crossio-core 0.1.0

Core abstractions for the crossio async I/O backend
Documentation
//! Readiness interests that can be registered with a backend.
use bitflags::bitflags;

bitflags! {
    /// Bitmask describing the types of readiness notifications a caller cares about.
    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
    pub struct Interest: u8 {
        /// Ready to read without blocking.
        const READABLE = 0b0001;
        /// Ready to write without blocking.
        const WRITABLE = 0b0010;
        /// Exceptional conditions (errors, priority data).
        const PRIORITY = 0b0100;
        /// Underlying stream has been closed for reads or writes.
        const CLOSED = 0b1000;
    }
}

impl Interest {
    /// Convenience for `READABLE | WRITABLE`.
    pub const fn readable_writable() -> Self {
        Self::READABLE.union(Self::WRITABLE)
    }
}