WorldId
#
A WorldId
defines the top-level namespace for procs and actors. All procs, actors, ports, and gangs exist within a world.
#[derive(
Debug,
Serialize,
Deserialize,
Clone,
PartialEq,
Eq,
PartialOrd,
Hash,
Ord,
Named
)]
pub struct WorldId(pub String);
Construction#
A WorldId
wraps a string and can be created directly:
use hyperactor::reference::WorldId;
let world = WorldId("training".into());
Or statically using the id!
macro:
use hyperactor::id;
let world = id!(training); // Equivalent to WorldId("training".into())
Methods#
impl WorldId {
pub fn name(&self) -> &str;
pub fn proc_id(&self, index: usize) -> ProcId;
pub fn random_user_proc(&self) -> ProcId;
}
.name()
returns the world name string..proc_id(index)
constructs aProcId
rooted in this world..random_user_proc()
generates aProcId
with the high bit set, marking it as a user-space proc ID.
Traits#
WorldId
implements:
Display
— string form is just the world nameFromStr
— parses from “training” into WorldId(“training”)Ord
,Eq
,Hash
— suitable for use as map/set keysNamed
— used for type reflection and message dispatch