Expand description
A Rust library for parsing and formatting JAML (Just Another Markup Language).
JAML is a human-readable data serialization format similar to YAML but with explicit integer and binary types. It shares the same data model as JASN, providing a YAML-like syntax as an alternative to the JSON5-like JASN format.
§Features
- Explicit Integer Types: Distinguish between integers and floats (2 vs 2.0).
- Binary Data: Support for base64 and hex-encoded binary data
- Timestamps: ISO8601/RFC3339 timestamps
- YAML-inspired syntax: Indentation-based structure, cleaner appearance
§Usage
§AST Manipulation (no serde required)
use jaml::{parse, format};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let value = parse(r#"
name: "Alice"
age: 30
balance: 1234.56
data: b64"SGVsbG8="
tags:
- "rust"
- "yaml"
- "parser"
"#)?;
println!("{:#?}", value);
// Format back to JAML
let formatted = format(&value);
println!("{}", formatted);
Ok(())
}§Serde Integration (default feature)
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
struct Person {
name: String,
age: u32,
}
let person = Person { name: "Alice".into(), age: 30 };
let jaml_text = jaml::to_string(&person).unwrap();
let parsed: Person = jaml::from_str(&jaml_text).unwrap();§Features
serde(default): Enable serde serialization/deserialization support
Re-exports§
pub use formatter::format;pub use formatter::format_with_opts;pub use de::from_str;pub use de::from_value;pub use ser::to_string;pub use ser::to_string_pretty;pub use ser::to_value;
Modules§
- de
- Deserialization of JAML text to Rust values.
- formatter
- Format a
Valueinto JAML text. - ser
- Serialization of Rust values to JAML text.
Structs§
Enums§
- Parse
Error - Errors that can occur during parsing.
- Value
- Represents a valid JASN value.
Functions§
Type Aliases§
- Parse
Result - Result type for parsing operations.
- Timestamp
- Type alias for timestamps (RFC3339/ISO8601 compatible).