Skip to main content

yog_data/
lib.rs

1//! Yog Data: one data model, text syntax, binary form and schema system for
2//! every Yog format, the build, the ABI and the IDE — the way Minecraft has
3//! NBT. See `docs/design/yog-data.md`.
4//!
5//! - [`Value`]: the model — JSON's values plus typed ones (content
6//!   references, tags, mod resources, Yog text, images, colors);
7//! - [`text`]: JSON with comments, trailing commas and unquoted keys,
8//!   parsed with the position of every value;
9//! - [`typed`]: the one grammar of the typed values' string forms
10//!   (`@item:minecraft:stick`, `@tag:item:minecraft:planks`, `@Strings.title`);
11//! - [`binary`]: the compact tagged form content crosses the ABI in.
12
13// `::yog_data::…` paths of `#[derive(Schema)]` work inside this crate too.
14extern crate self as yog_data;
15
16pub mod diagnostic;
17mod forms;
18mod model;
19mod wire;
20
21#[cfg(feature = "json")]
22pub use forms::json;
23#[cfg(feature = "toml")]
24pub use forms::toml;
25pub use forms::{patch, source, text};
26pub use model::{atom, typed};
27pub use schema::with;
28pub use wire::{binary, export, frame, io};
29
30pub use atom::Atom;
31pub use bumpalo::Bump;
32pub use diagnostic::{Diagnostic, Errors, Severity};
33pub use model::borrowed::{MapRef, ValueRef};
34pub use model::value::{Map, Path, Ref, Res, Seg, Value};
35pub use text::{Doc, LineCol, Span, Spans, SyntaxError};
36pub use wire::stream::{Stream, StreamWriter};
37pub mod schema;
38
39pub use schema::{
40    AnyRefOrTag, BlockId, Color, EntityId, Id, Image, ItemId, ItemIdOrTag, Kind, Kinds, OneOrList,
41    OneOrTag, Ordered, Read, Reader, RecipeId, Resolve, Schema, Shape, TagId, Text, built_in,
42    from_doc_with, from_text, from_value, from_value_with, kinds, placed, read_bytes,
43    read_ref_value, read_value, to_bytes, to_text,
44};
45pub use yog_data_derive::Schema;