Enum plist::Value[][src]

pub enum Value {
    Array(Vec<Value>),
    Dictionary(Dictionary),
    Boolean(bool),
    Data(Vec<u8>),
    Date(Date),
    Real(f64),
    Integer(Integer),
    String(String),
    Uid(Uid),
    // some variants omitted
}
Expand description

Represents any plist value.

Variants

Array(Vec<Value>)
Dictionary(Dictionary)
Boolean(bool)
Data(Vec<u8>)
Date(Date)
Real(f64)
Integer(Integer)
String(String)
Uid(Uid)

Implementations

Reads a Value from a plist file of any encoding.

Reads a Value from a seekable byte stream containing a plist of any encoding.

Reads a Value from a seekable byte stream containing an XML encoded plist.

Serializes a Value to a file as a binary encoded plist.

Serializes a Value to a file as an XML encoded plist.

Serializes a Value to a byte stream as a binary encoded plist.

Serializes a Value to a byte stream as an XML encoded plist.

Serializes a Value to a stream, using custom XmlWriteOptions.

If you need to serialize to a file, you must acquire an appropriate Write handle yourself.

Examples

use std::io::{BufWriter, Write};
use std::fs::File;
use plist::{Dictionary, Value, XmlWriteOptions};

let value: Value = Dictionary::new().into();
// .. add some keys & values
let mut file = File::create("com.example.myPlist.plist").unwrap();
let options = XmlWriteOptions::default().indent_string("  ");
value.to_writer_xml_with_options(BufWriter::new(&mut file), &options).unwrap();
file.sync_all().unwrap();

If the Value is a Array, returns the underlying Vec.

Returns None otherwise.

This method consumes the Value. To get a reference instead, use as_array.

If the Value is an Array, returns the associated Vec.

Returns None otherwise.

If the Value is an Array, returns the associated mutable Vec.

Returns None otherwise.

If the Value is a Dictionary, returns the associated BTreeMap.

Returns None otherwise.

This method consumes the Value. To get a reference instead, use as_dictionary.

If the Value is a Dictionary, returns the associated BTreeMap.

Returns None otherwise.

If the Value is a Dictionary, returns the associated mutable BTreeMap.

Returns None otherwise.

If the Value is a Boolean, returns the associated bool.

Returns None otherwise.

If the Value is a Data, returns the underlying Vec.

Returns None otherwise.

This method consumes the Value. If this is not desired, please use as_data method.

If the Value is a Data, returns the associated Vec.

Returns None otherwise.

If the Value is a Date, returns the associated Date.

Returns None otherwise.

If the Value is a Real, returns the associated f64.

Returns None otherwise.

If the Value is a signed Integer, returns the associated i64.

Returns None otherwise.

If the Value is an unsigned Integer, returns the associated u64.

Returns None otherwise.

If the Value is a String, returns the underlying String.

Returns None otherwise.

This method consumes the Value. If this is not desired, please use as_string method.

If the Value is a String, returns the associated str.

Returns None otherwise.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.