Skip to main content

Crate tealeaf

Crate tealeaf 

Source
Expand description

TeaLeaf - Schema-aware data format

§Example

use tealeaf::{TeaLeaf, Value};

let doc = TeaLeaf::parse(r#"
    @struct user (id: int, name: string)
    users: @table user [
        (1, alice),
        (2, bob),
    ]
"#).unwrap();

let users = doc.get("users").unwrap();

Re-exports§

pub use convert::ToTeaLeaf;
pub use convert::FromTeaLeaf;
pub use convert::ConvertError;
pub use convert::ToTeaLeafExt;
pub use builder::TeaLeafBuilder;

Modules§

builder
Builder for constructing TeaLeaf documents from multiple DTOs.
convert
DTO conversion traits for TeaLeaf documents

Structs§

Field
FieldType
IndexMap
A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.
Lexer
Parser
Reader
Binary format reader with mmap support for zero-copy access
Schema
SchemaInferrer
Schema inferrer that analyzes data and generates schemas
TeaLeaf
A parsed TeaLeaf document
Token
Union
A discriminated union type
Variant
A variant in a union type
Writer

Enums§

Error
TLType
TokenKind
Value

Constants§

HEADER_SIZE
MAGIC
MAX_ARRAY_LENGTH
Maximum number of elements in an array (u32 encoding limit)
MAX_OBJECT_FIELDS
Maximum number of fields in an object/struct (u16 encoding limit)
MAX_STRING_LENGTH
Maximum length of a string in the string table (u32 encoding limit)
VERSION
Library version string (beta/RFC stage)
VERSION_MAJOR
Binary format version (major) - for compatibility checks
VERSION_MINOR
Binary format version (minor) - for compatibility checks

Functions§

dumps
dumps_with_schemas
Serialize data to TeaLeaf text format with schemas
loads
Convenience: load and get data
open
Read a binary TeaLeaf file
parse
Parse TeaLeaf text

Type Aliases§

ObjectMap
Ordered map type for object fields — preserves insertion order.
Result