Skip to main content

Module atom

Module atom 

Source
Expand description

Atoms: names that repeat across messages (minecraft:stone, a live entity’s kind) kept once a process and sent on the bus as their number. An Atom is a u32: copied, compared and packed as one; its text is the table’s, alive as long as the process. A frame carries the number, every other form (text, the tagged binary form, files) the text — the numbers mean nothing outside the process.

The table is the runtime’s: a mod’s copy of this crate is pointed at it (install) so every mod and the host agree on the numbers. Without one (tools, tests) the crate keeps its own.

use yog_data::Atom;

let stone = Atom::new("minecraft:stone");
assert_eq!(stone, Atom::new("minecraft:stone"));
assert_eq!(stone.as_str(), "minecraft:stone");

Modules§

local
The table a process keeps itself: the runtime’s, or a tool’s. The table a process keeps itself: the runtime’s, or a tool’s.

Structs§

Atom
A name kept once a process; see the module.
Table
The table’s two functions: a name’s number (made the first time), and a number’s name (None: no such atom).

Functions§

install
Points this copy of the crate at the process’s table (the runtime’s); before any atom is made. False if it has one already.