Sign in

    moonrockz/diagrams/data-tree does not have a README file

    DataTree

    pub struct DataTree {
    id : String
    root : String
    nodes : ReadOnlyArray[Node]
    highlights : ReadOnlyArray[Highlight]
    title : String?
    accessibility_title : String?
    accessibility_description : String?
    } derive(Eq,
    Debug
    )

    One immutable structured-data diagram. It does not depend on JSON or YAML.

    DataTree::equal

    fn DataTree::equal(DataTree, DataTree) -> Bool

    DataTree::new

    fn DataTree::new(id : String, root : String, nodes : ArrayView[Node], highlights? : ArrayView[Highlight], title? : String, accessibility_title? : String, accessibility_description? : String) -> DataTree

    DataTree::not_equal

    fn DataTree::not_equal(x : DataTree, y : DataTree) -> Bool

    DataTree::to_repr

    Highlight

    pub struct Highlight {
    targets : ReadOnlyArray[String]
    style : String?
    } derive(Eq,
    Debug
    )

    A view highlight. Targets are member or node identities. The optional style is inert author metadata; library themes paint every highlight.

    Highlight::equal

    fn Highlight::equal(Highlight, Highlight) -> Bool

    Highlight::new

    fn Highlight::new(targets : ArrayView[String], style? : String) -> Highlight

    Highlight::not_equal

    fn Highlight::not_equal(x : Highlight, y : Highlight) -> Bool

    Index

    pub struct Index {
    tree : DataTree
    order : ReadOnlyArray[String]
    // private fields
    }

    A validated data tree with constant-time lookups. Each node except the root has exactly one owning entry occurrence.

    Index::build

    fn Index::build(tree : DataTree, limits? : Limits) -> IndexResult

    Validate identities, containment, keys, numbers, highlights and limits without recursion. Scalar text is never interpreted as a reference.

    Index::container

    fn Index::container(self : Index, entry : String) -> String?

    The container node that holds a entry occurrence.

    Index::depth

    fn Index::depth(self : Index, node : String) -> Int?

    Index::find_member

    fn Index::find_member(self : Index, id : String) -> Member?

    Index::node

    fn Index::node(self : Index, id : String) -> Node?

    Index::owner

    fn Index::owner(self : Index, node : String) -> Member?

    The entry occurrence that owns a node. The root has none.

    IndexResult

    pub struct IndexResult {
    index : Index?
    diagnostics : ReadOnlyArray[
    Diagnostic
    ]
    }

    Key

    pub(all) enum Key {
    Name(String)
    Index(Int)
    } derive(Eq,
    Debug
    )

    The key of one member occurrence: an object member name or an array position.

    Key::equal

    fn Key::equal(Key, Key) -> Bool

    Key::not_equal

    fn Key::not_equal(x : Key, y : Key) -> Bool

    Key::to_repr

    Limits

    pub struct Limits {
    nodes : Int
    depth : Int
    work : Int
    } derive(Eq,
    Debug
    )

    Explicit bounds for data-tree validation and indexing.

    Limits::equal

    fn Limits::equal(Limits, Limits) -> Bool

    Limits::new

    fn Limits::new(nodes? : Int, depth? : Int, work? : Int) -> Limits

    Limits::not_equal

    fn Limits::not_equal(x : Limits, y : Limits) -> Bool

    Limits::to_repr

    Member

    pub struct Member {
    id : String
    key : Key
    value : String
    source :
    Span
    ?
    } derive(Eq,
    Debug
    )

    One member occurrence of a container. value names the child node. Repeated names and equal values keep separate member identities.

    Member::equal

    fn Member::equal(Member, Member) -> Bool

    Member::index

    fn Member::index(id : String, index : Int, value : String, source? :
    Span
    ) -> Member

    Member::named

    fn Member::named(id : String, name : String, value : String, source? :
    Span
    ) -> Member

    Member::not_equal

    fn Member::not_equal(x : Member, y : Member) -> Bool

    Member::to_repr

    Node

    pub struct Node {
    id : String
    value : Value
    source :
    Span
    ?
    } derive(Eq,
    Debug
    )

    Node::array

    fn Node::array(id : String, members : ArrayView[Member], source? :
    Span
    ) -> Node

    Node::equal

    fn Node::equal(Node, Node) -> Bool

    Node::is_container

    fn Node::is_container(self : Node) -> Bool

    Node::members

    fn Node::members(self : Node) -> ReadOnlyArray[Member]

    The member occurrences of a container, or an empty array for a scalar.

    Node::new

    fn Node::new(id : String, value : Value, source? :
    Span
    ) -> Node

    Node::not_equal

    fn Node::not_equal(x : Node, y : Node) -> Bool

    Node::object

    fn Node::object(id : String, members : ArrayView[Member], source? :
    Span
    ) -> Node

    Node::to_repr

    Value

    pub(all) enum Value {
    Object(ReadOnlyArray[Member])
    Array(ReadOnlyArray[Member])
    Text(String)
    Number(String)
    Boolean(Bool)
    Null
    } derive(Eq,
    Debug
    )

    A typed value. Numbers keep their exact decimal lexeme; no machine floating-point value is computed.

    Value::equal

    fn Value::equal(Value, Value) -> Bool

    Value::not_equal

    fn Value::not_equal(x : Value, y : Value) -> Bool

    Value::scalar_text

    fn Value::scalar_text(self : Value) -> String?

    The visible text of a scalar value, or None for a container.

    Value::to_repr

    diagnostic_codes

    let diagnostic_codes : ReadOnlyArray[String]

    The stable diagnostic codes of data-tree validation.

    valid_number

    fn valid_number(lexeme : String) -> Bool

    True when lexeme is a valid JSON number spelling.

    validate

    fn validate(tree : DataTree, limits? : Limits) -> ReadOnlyArray[
    Diagnostic
    ]

    Validate a constructed data tree. An empty result means the tree is valid.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io