Skip to main content

Crate yog_data

Crate yog_data 

Source
Expand description

Yog Data: one data model, text syntax, binary form and schema system for every Yog format, the build, the ABI and the IDE — the way Minecraft has NBT. See docs/design/yog-data.md.

  • Value: the model — JSON’s values plus typed ones (content references, tags, mod resources, Yog text, images, colors);
  • text: JSON with comments, trailing commas and unquoted keys, parsed with the position of every value;
  • typed: the one grammar of the typed values’ string forms (@item:minecraft:stick, @tag:item:minecraft:planks, @Strings.title);
  • binary: the compact tagged form content crosses the ABI in.

Re-exports§

pub use text::Doc;
pub use text::LineCol;
pub use text::Span;
pub use text::Spans;
pub use text::SyntaxError;
pub use schema::BlockId;
pub use schema::Color;
pub use schema::EntityId;
pub use schema::Errors;
pub use schema::Id;
pub use schema::Image;
pub use schema::ItemId;
pub use schema::ItemIdOrTag;
pub use schema::Kind;
pub use schema::OneOrTag;
pub use schema::Ordered;
pub use schema::Read;
pub use schema::Reader;
pub use schema::RecipeId;
pub use schema::Schema;
pub use schema::Shape;
pub use schema::TagId;
pub use schema::Text;
pub use schema::from_text;
pub use schema::from_value;
pub use schema::kinds;
pub use schema::to_text;

Modules§

binary
The binary form — what the build compiles content to and the runtime and the Java hosts read, like NBT:
schema
Schemas: a format is a Rust type implementing Schema (usually #[derive(Schema)]). One schema reads and writes the format, checks it with the path of every problem, collects its references for the build to check, and describes itself (Shape) for Yog-IDLE’s editors and the docs.
text
The text syntax: JSON, plus // and /* */ comments, trailing commas and unquoted keys (the part of JSON5 editors already understand).
typed
The typed values’ string forms — one grammar for every format:

Macros§

kind
Declares kinds of content: yog_data::kind!(Pattern = "pattern");.

Structs§

Map
A map: entries in file order, keys unique.
Path
Where a value is in a document: entries[2].pages[0].item.
Ref
A reference to content: its kind (item, block, entity, recipe, entry, category, or a mod’s own) and id (minecraft:stick, minecraft:furnace[facing=north]).
Res
A mod resource: @<set>.<key> — @Strings.screen.title is set Strings, key screen.title.

Enums§

Seg
One step of a Path.
Value
A Yog Data value.

Derive Macros§

Schema