Native Executor
Platform-native async task executor that leverages OS event loops (GCD, GDK) for optimal performance.
Features
- Platform-native scheduling: Direct GCD integration on Apple platforms
- Priority-aware execution: Background vs default task prioritization
- Thread-local safety: Non-Send future execution with compile-time guarantees
- Thread-safe utilities:
LocalValue
,OnceValue
,MainValue
containers - Zero-cost abstractions: Direct OS API usage, no additional runtime
Installation
Add this to your Cargo.toml
:
[]
= "0.5"
Quick Start
use ;
use Duration;
// Spawn a task with default priority
let handle = spawn_local;
// Keep the main thread alive to allow tasks to complete
sleep;
Core Components
Task Spawning
use ;
spawn;
spawn_local;
spawn_main;
spawn_with_priority;
Timers
use ;
use Duration;
# async ;
Thread-Safe Containers
use ;
// Thread-local access only
let local = new;
assert_eq!;
// Single-consumption semantics
let once = new;
let value = once.take;
// Cross-thread with main-thread execution
let main_val = new;
# async ;
Platform Support
Current: Apple platforms (macOS, iOS, tvOS, watchOS) via Grand Central Dispatch
Planned: Linux (GDK), Android (Looper)
Unsupported platforms fail at compile-time with clear error messages.
Examples
License
This project is licensed under the MIT License.