2 unstable releases
Uses new Rust 2024
| 0.1.0 | Mar 27, 2026 |
|---|---|
| 0.0.0 | Sep 21, 2025 |
#1571 in Configuration
68KB
1.5K
SLoC
maml
A Rust implementation of the MAML data format — a minimal, human-readable alternative to JSON, YAML, and TOML.
Installation
[dependencies]
maml = "0.1"
Usage
Parsing
use maml::{parse, Value};
let value = parse(r#"
{
project: "MAML"
tags: [
"minimal"
"readable"
]
# A nested object
spec: {
version: 1
author: "Anton Medvedev"
}
notes: """
This is a raw multiline string.
Keeps formatting as-is.
"""
}
"#).unwrap();
assert_eq!(value["project"], Value::String("MAML".into()));
assert_eq!(value["spec"]["version"], Value::Int(1));
Serializing
use maml::{stringify, Value};
let value = Value::Object(vec![
("name".into(), Value::String("maml".into())),
("version".into(), Value::Int(1)),
("enabled".into(), Value::Bool(true)),
]);
let output = stringify(&value).unwrap();
// {
// name: "maml"
// version: 1
// enabled: true
// }
Value type
pub enum Value {
Null,
Bool(bool),
Int(i64),
Float(f64),
String(String),
Array(Vec<Value>),
Object(Vec<(String, Value)>),
}
Value supports indexing with ["key"] for objects and [0] for arrays, and provides accessor methods like
as_str(), as_i64(), as_bool(), as_array(), as_object(), get(key), and is_null().
MAML format
{
# Comments start with hash
key: "quoted string"
identifier_key: 42
array: [
"comma or newline separated"
true
null
3.14
]
raw_string: """
No escaping needed here.
Preserves \n and "quotes" as-is.
"""
}
See the full MAML specification.
License
Dependencies
~115–395KB