Narra

Reference

std/shape

std/shape

Value, a dynamic tree for structured data, and the Shape trait.

narra
import * as Shapes from "std/shape"

The guide teaches it in chapter 7, Traits.

This page is generated by scripts/std/generate.nra from narrac query --json interface std/shape. Do not edit it.

Types

Value

narra
export enum Value implements Shape {
  Null
  Bool(value: bool)
  Int(value: int)
  Float(value: f64)
  Text(value: string)
  List(items: Array<Value>)
  Record(fields: Map<string, Value>)
}

Shape

narra
export trait Shape {
  function toValue(value: Self): Value from value uses alloc
  function fromValue(value: Value): Result<Self, string> from value uses alloc
}