#plist #parser

plist

A rusty plist parser. Supports Serde serialization.

38 releases (7 stable)

1.3.1 Nov 17, 2021
1.2.1 Aug 8, 2021
1.2.0 Jul 23, 2021
1.1.0 Jan 31, 2021
0.0.10 Nov 6, 2015

#20 in Encoding

Download history 8426/week @ 2021-08-13 9909/week @ 2021-08-20 9396/week @ 2021-08-27 8221/week @ 2021-09-03 10248/week @ 2021-09-10 8366/week @ 2021-09-17 7762/week @ 2021-09-24 9503/week @ 2021-10-01 8623/week @ 2021-10-08 10120/week @ 2021-10-15 10811/week @ 2021-10-22 9866/week @ 2021-10-29 8627/week @ 2021-11-05 10807/week @ 2021-11-12 10463/week @ 2021-11-19 11029/week @ 2021-11-26

42,353 downloads per month
Used in 208 crates (37 directly)

MIT license

210KB
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

~1.5MB
~29K SLoC