neco-plist 0.1.0

zero dependency plist XML subset parser
Documentation
  • Coverage
  • 8.33%
    1 out of 12 items documented1 out of 4 items with examples
  • Size
  • Source code size: 16.99 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 402.01 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • barineco/neco-parser
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • barineco

neco-plist

日本語

zero dependency plist XML subset parser.

Features

  • XML-shaped plist dictionaries converted to ordered maps
  • Nested XML elements converted recursively
  • Empty XML elements converted to empty strings
  • Scalar parsing for null, bool, number, and string values
  • ParseError with byte-oriented position and message

Usage

Parse

use neco_plist::{parse, PlistValue};

let value = parse("<dict><name>neco</name></dict>").unwrap();
assert!(matches!(value, PlistValue::Map(_)));

Read fields

use neco_plist::{parse, PlistValue};

let value = parse("<dict><name>neco</name></dict>").unwrap();
let PlistValue::Map(fields) = value else { panic!("map") };
assert!(fields.iter().any(|(key, value)| {
    key == "name" && matches!(value, PlistValue::String(text) if text == "neco")
}));

API

Item Description
parse(input: &str) -> Result<PlistValue, ParseError> Parses the supported plist XML subset
PlistValue Null, Bool, Number(f64), String, List, or ordered Map
ParseError Reports byte position and message

Format support

The supported subset covers lightweight XML property-list shapes used as configuration data. It maps element names to fields and preserves field order. Binary plist and full Apple plist semantics are represented by later parser coverage, not this minimal subset crate.

License

MIT