Skip to main content

Crate kithara_platform

Crate kithara_platform 

Source
Expand description

Platform-aware primitives for native and wasm32 targets.

§Synchronization

Re-exports sync primitives (Mutex, Condvar, RwLock, mpsc) backed by parking_lot / std on native and [wasm_safe_thread] on WASM.

§Async tasks

tokio::task module: tokio::task::spawn, tokio::task::spawn_blocking, tokio::task::yield_now.

§Conditional trait bounds

MaybeSend and MaybeSync are conditional trait bounds: on native they equal Send/Sync, on wasm32 they are blanket-implemented for all types. Use in trait bounds to avoid duplicating trait definitions with #[cfg] gates.

§Async utilities

time::sleep delegates to tokio::time::sleep on native and to setTimeout on wasm32.

Re-exports§

pub use sync::Condvar;
pub use sync::Mutex;
pub use sync::MutexGuard;
pub use sync::NotAvailable;
pub use sync::RwLock;
pub use sync::RwLockReadGuard;
pub use sync::RwLockWriteGuard;
pub use thread::JoinHandle;
pub use thread::Thread;
pub use thread::ThreadId;
pub use thread::current;
pub use thread::park;
pub use thread::park_timeout;
pub use thread::sleep;
pub use thread::spawn;

Modules§

sync
Platform-optimal synchronization primitives.
thread
time
tokio
Cross-platform tokio — real tokio on native, WASM shims on wasm32.

Structs§

CancelGroup
OR-combinator for cancellation tokens.
Duration
A Duration type to represent a span of time, typically used for system timeouts.
WasmSend
Wrapper that unconditionally implements Send on WASM.

Traits§

MaybeSend
MaybeSendFuture
Trait alias for Future + MaybeSend.
MaybeSync

Functions§

env_mutation_lock
Returns a process-wide mutex that serializes mutations of std::env across threads.

Type Aliases§

BoxFuture
Boxed future that is Send on native, unrestricted on WASM.