Skip to main content

Crate lino_objects_codec

Crate lino_objects_codec 

Source
Expand description

Object encoder/decoder for Links Notation format.

This library provides encoding and decoding of JSON-like objects to/from Links Notation format. It supports all common JSON types plus special float values (NaN, Infinity, -Infinity).

§Features

  • Universal Serialization: Encode objects to Links Notation format
  • Type Support: Handle all common types: null, boolean, integer, float, string, array, object
  • Special Float Values: Support for NaN, Infinity, -Infinity (which are not valid JSON)
  • Circular References: Detect and preserve circular references (via object IDs)
  • Object Identity: Maintain object identity for shared references
  • UTF-8 Support: Full Unicode string support using base64 encoding
  • Simple API: Easy-to-use encode() and decode() functions

§Example

use lino_objects_codec::{encode, decode, LinoValue};

// Encode a simple object
let data = LinoValue::object([
    ("name", LinoValue::String("Alice".to_string())),
    ("age", LinoValue::Int(30)),
    ("active", LinoValue::Bool(true)),
]);
let encoded = encode(&data);
let decoded = decode(&encoded).unwrap();
assert_eq!(decoded, data);

Modules§

format
Formatting utilities for indented Links Notation format.

Structs§

ObjectCodec
Codec for encoding/decoding LinoValue to/from Links Notation.

Enums§

CodecError
Error types for codec operations
LinoValue
A value that can be encoded/decoded using the Links Notation codec.

Functions§

decode
Decode Links Notation format to a value.
encode
Encode a value to Links Notation format.