// Declarations whose generated Rust needs care: Rust keywords as names, a
// type that holds itself, generic types applied to arguments, a type with
// no order.
use "std@v1/json"
/// A list that holds its own tail.
pub type Chain {
pub head: Int,
/// The rest, when there is any.
pub next: Option<Chain>,
pub branches: List<Chain>,
}
pub type Tree { Leaf(Int), Node(Tree, Tree), Forest(List<Tree>) }
pub type Box<T> { pub value: T }
pub type Keywords {
pub impl: Int,
pub ref: Text,
pub self: Bool,
pub mod: Option<Int>,
}
pub type Loose { pub raw: json.Value, pub nested: Box<json.Value> }
pub type Shape {
Dot,
Labelled { label: Option<Text>, size: Int },
Pair((Int, Text)),
}
pub type Tools { Tools(Int) }
pub flow walk(chain: Chain, tree: Tree) -> Int
pub flow wrap(boxed: Box<Int>, texts: Box<Text>, keys: Dict<Int, Text>) -> Result<Box<Box<Int>>, Unit>
pub flow fn(context: Keywords, loose: Loose, shape: Shape) -> Tools
pub flow pick<T>(options: List<T>, boxed: Box<T>) -> T