Skip to main content

Crate apple_plist

Crate apple_plist 

Source
Expand description

Apple property-list serialization for Rust: XML, binary (bplist00), OpenStep, and GNUStep — encode and decode.

apple-plist is a serde-native Rust library for Apple property lists. Unlike most Rust plist crates it targets all four Apple property-list dialects in both directions, handling the edge cases that show up in real-world files.

§Quick start

Decoding auto-detects the format; encoding picks the format you name:

use apple_plist::{Format, Value, detect};

let bytes = apple_plist::to_vec(&true, Format::Xml)?;
assert!(bytes.ends_with(b"<true/></plist>"));

let value: Value = apple_plist::from_slice(&bytes)?;
assert_eq!(value, Value::Boolean(true));
assert_eq!(detect(&bytes), Some(Format::Xml));

Streaming and Value-tree variants live on Encoder and Decoder; both compile with every feature combination and work without serde.

§Status

The full surface is implemented: the core data model (Value and its nine cases, Integer, Real, Date, Uid, the Error model, Format, the depth bound), all four codecs behind their feature gates, format auto-detection (detect, the XML-to-text retry ladder), and the serde bridge (to_vec, from_slice, to_value, from_value, and friends).

§Cargo features

All on by default; every combination compiles and features only add API:

Decoding a format whose feature is compiled out fails with Error::InvalidPlist from its rung of the detection ladder; encoding one fails with Error::FeatureDisabled.

Structs§

Date
An absolute point in time: a UTC instant with nanosecond precision.
Decoder
Reads one property-list document from a reader, auto-detecting its Format.
Encoder
Writes property-list documents to a writer in a chosen Format.
Real
A property-list real number.
Uid
A UID value, as found in NSKeyedArchiver / CF$UID property lists.

Enums§

Error
Errors returned while encoding or decoding a property list.
Format
A property-list serialization format.
Integer
A property-list integer, carrying its signedness.
Value
Any value a property list can hold.

Constants§

MAX_PARSE_DEPTH
The maximum structural nesting depth any parser descends before returning Error::MaxDepthExceeded.

Functions§

detect
Identifies the property-list format of data, or None when no enabled codec accepts it.
from_reader
Deserializes a property-list document from a reader, auto-detecting its format.
from_slice
Deserializes a property-list document from a byte slice, auto-detecting its format.
from_value
Converts an owned Value tree into any DeserializeOwned type, always in strict mode (the lax string coercions are reserved for the OpenStep decode path).
to_value
Converts any Serialize value into an owned Value tree.
to_vec
Serializes value into a new byte vector in the given format.
to_vec_indent
Serializes value into a new, pretty-printed byte vector.
to_writer
Serializes value to writer in the given format.

Type Aliases§

Dictionary
An order-preserving plist dictionary.
Result
A specialized Result for property-list operations.