Skip to main content

Crate pragma_base

Crate pragma_base 

Source
Expand description

The L0 foundation of pragma.core: typed errors, generational handles and simulation ticks.

The crate knows nothing about threads and contains no unsafe; every upper layer builds on it.

use pragma_base::{HandlePool, Tick};

let mut pool = HandlePool::<&str>::new();
let h = pool.insert("job-name")?;
assert_eq!(pool.get(h), Some(&"job-name"));
pool.remove(h)?;
assert_eq!(pool.get(h), None); // a stale handle safely yields None

let t = Tick::ZERO.next()?;
assert_eq!(t.get(), 1);

Structs§

Handle
A generational handle: (index, generation).
HandlePool
A pool of values addressed by Handle. Freed slots are reused.
Tick
Tick number of the fixed simulation step.

Enums§

BaseError
Errors of the L0 primitives.