Crate plist

source ·
Expand description

§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;
#[macro_use]
extern crate serde_derive;

#[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");

§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.

Re-exports§

Modules§

Structs§

  • A byte buffer used for serialization to and from the plist data type.
  • A UTC timestamp used for serialization to and from the plist date type.
  • This type represents all possible errors that can occur when working with plist data.
  • An integer that can be represented by either an i64 or a u64.
  • An error indicating that a string was not a valid XML plist date.
  • A plist uid value. These are found exclusively in plists created by NSKeyedArchiver.
  • Options for customizing serialization of XML plists.

Enums§

  • Represents any plist value.

Functions§

  • Deserializes an instance of type T from a byte slice.
  • Deserializes an instance of type T from a plist file of any encoding.
  • Deserializes an instance of type T from a seekable byte stream containing a plist of any encoding.
  • Deserializes an instance of type T from a byte stream containing an ASCII encoded plist.
  • Deserializes an instance of type T from a byte stream containing an XML encoded plist.
  • Interprets a Value as an instance of type T.
  • Serializes the given data structure to a file as a binary encoded plist.
  • Serializes the given data structure to a file as an XML encoded plist.
  • Converts a T into a Value which can represent any valid plist.
  • Serializes the given data structure to a byte stream as a binary encoded plist.
  • Serializes the given data structure to a byte stream as an XML encoded plist.
  • Serializes to a byte stream as an XML encoded plist, using custom XmlWriteOptions.