Skip to main content

Module runtime

Module runtime 

Source
Expand description

Runtime abstraction layer for gatel.

Provides a common interface over different async runtimes. The default implementation uses Tokio. When the monoio feature is enabled, a monoio-based implementation is available for Linux systems with io_uring support.

§Architecture

The abstraction is intentionally thin — it wraps the most commonly used runtime operations (spawning tasks, sleeping, TCP operations) behind feature-gated implementations. Business logic uses these wrappers instead of calling tokio/monoio directly, making it possible to switch runtimes at compile time.

§Usage

use gatel_core::runtime;

// Spawn a background task
runtime::spawn(async { /* ... */ });

// Sleep
runtime::sleep(Duration::from_secs(1)).await;

Structs§

RuntimeInfo
Runtime information and capabilities.

Functions§

info
Get information about the active runtime.
interval
Create a periodic interval timer.
sleep
Sleep for the given duration.
spawn
Spawn a new async task on the current runtime.