#plist #parser

plist

A rusty plist parser. Supports Serde serialization.

42 releases (11 stable)

new 1.4.3 Mar 19, 2023
1.4.1 Feb 17, 2023
1.3.1 Nov 17, 2021
1.2.0 Jul 23, 2021
0.0.10 Nov 6, 2015

#16 in Parser implementations

Download history 28873/week @ 2022-11-28 28675/week @ 2022-12-05 31519/week @ 2022-12-12 23964/week @ 2022-12-19 18178/week @ 2022-12-26 24154/week @ 2023-01-02 30431/week @ 2023-01-09 32261/week @ 2023-01-16 38789/week @ 2023-01-23 42344/week @ 2023-01-30 32900/week @ 2023-02-06 31595/week @ 2023-02-13 33203/week @ 2023-02-20 31770/week @ 2023-02-27 33306/week @ 2023-03-06 30123/week @ 2023-03-13

131,797 downloads per month
Used in 314 crates (64 directly)

MIT license

215KB
5.5K SLoC

Plist

A rusty plist parser.

Many features from previous versions are now hidden behind the enable_unstable_features_that_may_break_with_minor_version_bumps feature. These will break in minor version releases after the 1.0 release. If you really really must use them you should specify a tilde requirement e.g. plist = "~1.0.3" in you Cargo.toml so that the plist crate is not automatically updated to version 1.1.

Documentation


lib.rs:

Plist

A rusty plist parser.

Usage

Put this in your Cargo.toml:

[dependencies]
plist = "1"

And put this in your crate root:

extern crate plist;

Examples

Using serde

extern crate plist;
# #[cfg(feature = "serde")]
#[macro_use]
extern crate serde_derive;

# #[cfg(feature = "serde")]
# fn main() {
#[derive(Deserialize)]
#[serde(rename_all = "PascalCase")]
struct Book {
    title: String,
    author: String,
    excerpt: String,
    copies_sold: u64,
}

let book: Book = plist::from_file("tests/data/book.plist")
    .expect("failed to read book.plist");

assert_eq!(book.title, "Great Expectations");
# }
#
# #[cfg(not(feature = "serde"))]
# fn main() {}

Using Value

use plist::Value;

let book = Value::from_file("tests/data/book.plist")
    .expect("failed to read book.plist");

let title = book
    .as_dictionary()
    .and_then(|dict| dict.get("Title"))
    .and_then(|title| title.as_string());

assert_eq!(title, Some("Great Expectations"));

Unstable Features

Many features from previous versions are now hidden behind the enable_unstable_features_that_may_break_with_minor_version_bumps feature. These will break in minor version releases after the 1.0 release. If you really really must use them you should specify a tilde requirement e.g. plist = "~1.0.3" in you Cargo.toml so that the plist crate is not automatically updated to version 1.1.

Dependencies

~3MB
~49K SLoC