///|
/// A unique identifier for a `Runtime`.
///
/// Runtime ids are monotonically allocated when a `Runtime` is created and
/// scope every `CellId` / `AccumulatorId` to its originating runtime.
///
/// A `RuntimeId` is an *introspection / debug identity*: compare it for
/// equality ("are these two runtimes the same?"), use it as a map key, or
/// display it. It is **not** a stable application key across program runs, and
/// carries no ordering or arithmetic meaning — that is why it is a nominal
/// wrapper rather than a bare `Int`.
#derive(Eq, Hash, Debug)
pub(all) struct RuntimeId {
id : Int32
}
///|
pub extend RuntimeId with Eq::{not_equal, equal}
///|
pub extend RuntimeId with Debug::{to_repr}
///|
pub extend RuntimeId with Show::{output, to_string}
///|
pub extend RuntimeId with Hash::{hash, hash_combine}
///|
/// Wraps a raw runtime-allocation number as a `RuntimeId`.
pub fn RuntimeId::RuntimeId(id : Int32) -> RuntimeId {
{ id, }
}
///|
/// Shows the underlying allocation number (e.g. `0`), keeping runtime ids
/// readable in error messages and graph-visualization output.
pub impl Show for RuntimeId with fn output(self, logger) {
logger.write_string(self.id.to_string())
}