Module: encoding.value

Source: ./encoding/value.reef


Overview

encoding/value — JSON-shaped Value tree (Null/Bool/Int/Float/Str/Array/Object).

Constructors that would collide with reserved words use from_* names (from_bool, from_int, from_float, from_string, from_object).

Usage: import encoding.value as value let m = value.new_object() m.set("name", value.from_string("Ada")) let v = value.from_object(m) let name = value.get(v, "name")


Types

Value (enum)

Variants:

  • Null
  • Bool(bool)
  • Int(int)
  • Float(float)
  • Str(string)
  • Array([Value])
  • Object(hashmap.HashMap[string, Value])

Functions

fn null(): Value

fn from_bool(x: bool): Value

fn from_int(x: int): Value

fn from_float(x: float): Value

fn from_string(x: string): Value

fn array(items: [Value]): Value

fn from_object(m: hashmap.HashMap[string, Value]): Value

fn new_object(): hashmap.HashMap[string, Value]

fn new_array(n: int): [Value]

fn get(v: Value, key: string): option.Option[Value]

fn char_code(c: char): int

fn unrecovered_slot(tn: string): result.Result[Value, error.Error]

fn any_to_value(a: Any): result.Result[Value, error.Error]

fn from_any_map(m: hashmap.HashMap[string, Any]): result.Result[Value, error.Error]

fn to_json(v: Value): string


Procedures

proc append_escaped(b: sb.StringBuilder, s: string)

proc append_quoted(b: sb.StringBuilder, s: string)

proc append_json(b: sb.StringBuilder, v: Value)


Generated by reefc doc