Enum plist::Value[][src]

#[non_exhaustive]
pub enum Value {
    Array(Vec<Value>),
    Dictionary(Dictionary),
    Boolean(bool),
    Data(Vec<u8>),
    Date(Date),
    Real(f64),
    Integer(Integer),
    String(String),
    Uid(Uid),
}
Expand description

Represents any plist value.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Array(Vec<Value>)

Tuple Fields of Array

0: Vec<Value>
Dictionary(Dictionary)

Tuple Fields of Dictionary

0: Dictionary
Boolean(bool)

Tuple Fields of Boolean

0: bool
Data(Vec<u8>)

Tuple Fields of Data

0: Vec<u8>
Date(Date)

Tuple Fields of Date

0: Date
Real(f64)

Tuple Fields of Real

0: f64
Integer(Integer)

Tuple Fields of Integer

0: Integer
String(String)

Tuple Fields of String

0: String
Uid(Uid)

Tuple Fields of Uid

0: 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.

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

Returns None otherwise.

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

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

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

Deserialize this value from the given Serde deserializer. 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 !=.

Serialize this value into the given Serde serializer. Read more

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.