momo-rs 0.1.0

A high-performance, atomic-free asynchronous runtime optimized for thread-local affinity.
Documentation
//! # Momo
//!
//! A high-performance, atomic-free asynchronous runtime for Rust.
//!
//! **Momo** is an event-driven platform designed for writing non-blocking 
//! asynchronous applications with strict **Thread-Local Affinity**. Unlike 
//! traditional runtimes that rely on multi-threaded task migration, Momo 
//! pins tasks to their creation threads, eliminating synchronization overhead 
//! and core-to-core cache bouncing.
//!
//! ## Key Pillars
//!
//! - **[Execution Engine](crate::Executor)**: A localized task scheduler with zero-cost 
//!   cross-thread wakeups.
//! - **[Driver](crate::driver)**: A non-blocking I/O reactor supporting epoll, 
//!   kqueue, and IOCP.
//! - **[Time](crate::time)**: High-resolution timing via an O(1) hierarchical 
//!   timer wheel.
//! - **[Sync](crate::sync)**: Communication primitives optimized for 
//!   thread-local and cross-thread signaling.
//! - **[Net](crate::net)**: Unified async TCP and UDP networking.
//!
//! ## Getting Started
//!
//! Add **momo-rs** to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! momo-rs = "0.1"
//! ```
//!
//! ### A Simple Loop
//!
//! ```rust
//! use core::time::Duration;
//!
//! #[momo::main]
//! async fn main() {
//!     momo::spawn(async {
//!         println!("Hello from Momo!");
//!         momo::time::sleep(Duration::from_millis(50)).await;
//!         println!("Timer triggered on the local thread.");
//!     });
//! }
//! ```
//!
//! ## The Fixed-Affinity model
//!
//! In Momo, every task is owned by the thread that spawned it. 
//!
//! 1.  **No `Send` Constraints**: You can safely spawn and run futures that 
//!     are `!Send`, as they are guaranteed never to migrate to another thread.
//! 2.  **Deterministic Scheduling**: Local tasks are executed in a stable 
//!     FIFO order with a dedicated poll budget.
//! 3.  **Local Memory Safety**: Share state between tasks on the same thread 
//!     with `Rc<RefCell<T>>` instead of heavier atomic primitives.
//!
//! ## Feature Flags
//!
//! Momo is modular. Configure your imports with these features:
//!
//! - `full`: All features enabled (default).
//! - `net`: Async TCP/UDP primitives.
//! - `sync`: Unbounded MPSC and Oneshot channels.
//! - `time`: Hierarchical timer support and sleeps.
//! - `macros`: The `#[momo::main]` entry point macro.

#[doc(inline)]
pub use momo_rs_core::{spawn, Executor, has_pending_tasks, stop, is_stopped, yield_now, set_wakeup_handler};

#[cfg(feature = "driver")]
#[doc(inline)]
pub use momo_rs_driver as driver;

#[cfg(feature = "time")]
#[doc(inline)]
pub use momo_rs_time as time;

#[cfg(feature = "net")]
#[doc(inline)]
pub use momo_rs_net as net;

#[cfg(feature = "sync")]
#[doc(inline)]
pub use momo_rs_sync as sync;

/// The common prelude for Momo.
pub mod prelude {
    pub use crate::spawn;
    #[cfg(feature = "time")]
    pub use crate::time::sleep;
    #[cfg(feature = "net")]
    pub use crate::net::{TcpListener, TcpStream};
}

#[cfg(feature = "macros")]
#[doc(inline)]
pub use momo_rs_macros::main;