pub struct MachineId(/* private fields */);
Expand description
An opaque token representing one machine running inside the framework.
Values are guaranteed to be in the range 0..Framework::num_machines, so
raw values using MachineId::into_raw
are suitable for indexing a slice
of of at least Framework::num_machines
elements. This is handy for
framework integration and keeping associated state with a performance focus,
but care must be taken to avoid out-of-bounds accesses (i.e., not very Rust
idiomatic).
Implementations§
Source§impl MachineId
impl MachineId
Sourcepub fn from_raw(raw: usize) -> Self
pub fn from_raw(raw: usize) -> Self
Create a new machine identifier from a raw integer. Intended for use
with the machine
field of TriggerAction
and TriggerEvent
. For
testing and FFI-wrapper purposes only. For regular use, use
MachineId
returned by Framework::trigger_events. Triggering an
event in the framework for a machine that does not exist does not raise
a panic or any error.
Sourcepub fn into_raw(self) -> usize
pub fn into_raw(self) -> usize
Return the raw integer representation of the machine identifier. For
testing and FFI-wrapper purposes only. For regular use, use the
MachineId
returned by Framework::trigger_events.