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§
pub use dictionary::Dictionary;
Modules§
- dictionary
- A map of
Stringtoplist::Value.
Structs§
- Data
- A byte buffer used for serialization to and from the plist data type.
- Date
- A UTC timestamp used for serialization to and from the plist date type.
- Error
- This type represents all possible errors that can occur when working with plist data.
- Integer
- An integer that can be represented by either an
i64or au64. - Invalid
XmlDate - An error indicating that a string was not a valid XML plist date.
- Uid
- A plist
uidvalue. These are found exclusively in plists created byNSKeyedArchiver. - XmlWrite
Options - Options for customizing serialization of XML plists.
Enums§
- Value
- Represents any plist value.
Functions§
- from_
bytes - Deserializes an instance of type
Tfrom a byte slice. - from_
file - Deserializes an instance of type
Tfrom a plist file of any encoding. - from_
reader - Deserializes an instance of type
Tfrom a seekable byte stream containing a plist of any encoding. - from_
reader_ ascii - Deserializes an instance of type
Tfrom a byte stream containing an ASCII encoded plist. - from_
reader_ xml - Deserializes an instance of type
Tfrom a byte stream containing an XML encoded plist. - from_
value - Interprets a
Valueas an instance of typeT. - to_
file_ binary - Serializes the given data structure to a file as a binary encoded plist.
- to_
file_ xml - Serializes the given data structure to a file as an XML encoded plist.
- to_
value - Converts a
Tinto aValuewhich can represent any valid plist. - to_
writer_ binary - Serializes the given data structure to a byte stream as a binary encoded plist.
- to_
writer_ xml - Serializes the given data structure to a byte stream as an XML encoded plist.
- to_
writer_ xml_ with_ options - Serializes to a byte stream as an XML encoded plist, using custom
XmlWriteOptions.