Skip to main content

Module schema

Module schema 

Source
Expand description

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.

Modules§

kinds
The kinds every Yog format knows.

Structs§

EnumShape
Errors
Problems found reading a document, with where each is.
Field
Found
Where a reference was found.
Id
The id of content of kind K: written @item:minecraft:stick or, in a field that can only be an item, just minecraft:stick (stick).
Located
A problem and its place in the source.
Ordered
An object kept in file order, values of one schema.
Problem
A problem found reading a value.
Read
What reading a document gives: the value and the references in it.
Reader
The state of reading a value: where it is, the problems so far, and the references met (for the build to check against the content there is).
StructShape
TagId
A tag of content of kind K: @tag:item:minecraft:planks.
Variant

Enums§

Color
A color: #RRGGBB, #AARRGGBB, or a .yres color.
Image
An image: a source (sprite:button, mymod:gui/logo, item:minecraft:stick) or a .yres image.
OneOrTag
Content of kind K or a tag of it — a recipe ingredient.
Shape
What a format looks like: drives Yog-IDLE’s property grids and pickers, completion, hover docs and the docs’ field tables.
Text
A text a player reads: Yog text as written, a .yres text, the name of some content (@item:minecraft:stick shows “Stick”), or any translation key (@lang:gui.done).

Traits§

Kind
A kind of content: item, block, … — a mod declares its own with kind!.
Kinds
One kind or several ((Item, Block)): what a reference field takes.
Resolve
What a tool makes of the references and texts it reads: yog build checks each reference against the content there is and turns texts into translation keys; the IDE shows them.
Schema
A Yog Data format.

Functions§

field_names
The field names of a struct’s shape (none for anything else).
from_doc
Reads a parsed document as T; text is its source, for positions.
from_doc_with
from_doc, references and texts going through resolver.
from_text
Parses text and reads it as T; problems come with their line and column.
from_value
Reads v as T: the value and its references, or every problem.
from_value_with
from_value, references and texts going through resolver.
is_metadata_key
Source-only keys every object may have: $…, _…, comment.
read_both
A and B read from the same object — each allowing the other’s fields, like serde’s flatten: a recipe’s common fields and its kind’s.
read_ref
v as a reference to content of one of kinds (any kind if empty), written @kind:id — a bare id is an error that says how to write it.
to_text
value as text, indented.

Type Aliases§

BlockId
EntityId
ItemId
ItemIdOrTag
An item or an item tag: "minecraft:stick", "@tag:item:minecraft:planks".
RecipeId
ShapeFn
A shape, built on demand — so shapes of recursive types are fine.