#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unsafe_op_in_unsafe_fn)]
#![warn(missing_docs)]
#[cfg(feature = "alloc")]
extern crate alloc;
mod descriptor;
mod kernel_queue;
mod ring;
mod ring_optimized;
pub use descriptor::{MessageDescriptor, DescriptorValidator};
pub use kernel_queue::{KernelQueue, QueueConfig};
pub use ring::{RingBuffer, RingEntry, RingStats};
pub use ring_optimized::{OptimizedRingBuffer, OptimizedRingEntry, OptimizedRingSlot};
use ruvix_types::KernelError;
pub type Result<T> = core::result::Result<T, KernelError>;
#[cfg(feature = "std")]
pub type Duration = std::time::Duration;
#[cfg(not(feature = "std"))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Duration(u64);
#[cfg(not(feature = "std"))]
impl Duration {
pub const ZERO: Self = Self(0);
pub const MAX: Self = Self(u64::MAX);
pub const fn from_nanos(nanos: u64) -> Self {
Self(nanos)
}
pub const fn from_micros(micros: u64) -> Self {
Self(micros.saturating_mul(1_000))
}
pub const fn from_millis(millis: u64) -> Self {
Self(millis.saturating_mul(1_000_000))
}
pub const fn from_secs(secs: u64) -> Self {
Self(secs.saturating_mul(1_000_000_000))
}
pub const fn as_nanos(&self) -> u64 {
self.0
}
pub const fn is_zero(&self) -> bool {
self.0 == 0
}
}
#[cfg(test)]
mod tests {
#[test]
fn test_module_compiles() {
assert!(true);
}
}