Crate dportable

Source
Expand description

Portable interface for various utilities.

Intended targets are:

  • native platforms with tokio async runtime,
  • WebAssembly targeted to browsers, including WebWorkers, under standard single-threaded model.

Following features are provided:

Modules§

test
Tests-related macros.
time
Utilities for tracking time.
value
Asynchronous cloneable lazily-initialized value.

Macros§

create_non_sync_send_variant_for_wasm
Utility macro for creating non-Send and non-Sync variants of traits for use in WASM.

Structs§

JoinError
Task failed to execute to completion.
JoinHandle
An owned permission to join on a task (await its termination).

Functions§

random
Returns a floating-point, pseudo-random number in the range 0–1 (inclusive of 0, but not 1) with approximately uniform distribution over that range.
spawn
Spawns a new asynchronous task, returning a JoinHandle for it.

Type Aliases§

Mutex
A mutual exclusion primitive useful for protecting shared data
MutexGuard
An RAII implementation of a “scoped lock” of a mutex. When this structure is dropped (falls out of scope), the lock will be unlocked.
RwLock
A reader-writer lock
RwLockReadGuard
RAII structure used to release the shared read access of a lock when dropped.
RwLockWriteGuard
RAII structure used to release the exclusive write access of a lock when dropped.