Skip to main content

Module readable

Module readable 

Source
Expand description

Readable, indented Links Notation representation.

This module implements the default output of crate::encode: a plain-text, indented projection where keys and values are written as they are, so the file can be read, grepped and reviewed without decoding anything.

§Shape

One construct — ( ) — is used for both objects and arrays, at every level including the root. What distinguishes them is the content of the lines: key value pairs make an object, bare values make an array.

(
  type "RouterState"
  server (
    host "127.0.0.1"
    port 18878
  )
  models (
    "claude-haiku"
    "claude-opus"
  )
)

§Value mapping

LinoValueReadable form
Object( ) with one key value pair per line
Array( ) with one value per line
Stringquoted, never encoded
Int / Float / Bool / Nullbare, so the type survives the round trip

Empty containers keep their type: an empty array is () on one line, while an empty object is written as ( and ) on two lines.

Only values that cannot be written as plain text are encoded: strings holding control characters (including newlines and tabs, which line-based tooling and CRLF normalisation would corrupt) are marked individually as (base64 "…") instead of encoding the whole document.

Constants§

BASE64_MARKER
Marker used for values that cannot be represented as plain text.
DEFAULT_INDENT
Default indentation used by encode.

Functions§

decode
Decode the readable, indented Links Notation form back into a value.
encode
Encode a value into the readable, indented Links Notation form.