#plist #parser

plist

A rusty plist parser. Supports Serde serialization.

34 releases (3 stable)

1.1.0 Jan 31, 2021
1.0.1 Dec 27, 2020
1.0.0 Apr 18, 2020
0.5.5 Apr 18, 2020
0.0.10 Nov 6, 2015

#28 in Encoding

Download history 4758/week @ 2020-11-07 5880/week @ 2020-11-14 6926/week @ 2020-11-21 8236/week @ 2020-11-28 6675/week @ 2020-12-05 6255/week @ 2020-12-12 5491/week @ 2020-12-19 7303/week @ 2020-12-26 10747/week @ 2021-01-02 9273/week @ 2021-01-09 6560/week @ 2021-01-16 5850/week @ 2021-01-23 6860/week @ 2021-01-30 8196/week @ 2021-02-06 7763/week @ 2021-02-13 6636/week @ 2021-02-20

29,335 downloads per month
Used in 128 crates (21 directly)

MIT license

185KB
4.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

~2MB
~35K SLoC