Expand description
Parser and data model for .ion documents.
An Ion document is represented as Ion, which contains named Section values.
Each section can hold:
- a
Dictionaryof scalar, array, or nested dictionary fields - tabular
Rowdata
The crate provides two entry points:
§Feature flags
- default: section and dictionary storage use
BTreeMap, so iteration and serialization are sorted by key dictionary-indexmap: section and dictionary storage useIndexMap, so iteration and serialization preserve insertion order
§Examples
use ion::{Ion, Value};
let mut ion: Ion = r#"
[APP]
name = "demo"
retries = 3
"#.parse()?;
let app = ion.get_mut("APP").unwrap();
app.dictionary
.insert("enabled".to_owned(), Value::Boolean(true));
assert_eq!(Some("demo"), app.get("name").and_then(Value::as_str));§Ordering backend
The selected backend affects both Dictionary and Sections, which means it
changes:
- top-level section iteration
- document serialization via
std::string::ToString::to_string - dictionary field iteration
- nested dictionary serialization
Macros§
- ion
- Parses a string literal into
Ion. - ion_
filtered - Parses a string literal into
Ionwhile keeping only selected sections.
Structs§
- Into
Iter - Owning iterator over section rows.
- Ion
- Parsed Ion document.
- Parser
- Stateful parser for Ion text.
- Parser
Error - Structured parser error with location and source context.
- Section
- A named Ion section.
Enums§
- Element
- Low-level parser output item.
- IonError
- Errors returned by high-level Ion parsing and access APIs.
- Parser
Error Kind - Machine-readable parser error category.
- Value
- A typed Ion value.
Traits§
- FromIon
- Converts Ion values or sections into typed Rust values.
- FromRow
- Converts a row of
Valuecells into a typed Rust value. - Parse
Row - Extension trait for parsing a
Rowinto a typed value.
Type Aliases§
- Dictionary
- Dictionary storage used by
Section::dictionary. - Row
- A single table row stored inside a
Section. - Sections
- Top-level section storage used by
Ion.