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
Dictionary(Dictionary)
Boolean(bool)
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.
pub fn to_writer_xml_with_options<W: Write>(
&self,
writer: W,
options: &XmlWriteOptions
) -> Result<(), Error>
pub fn to_writer_xml_with_options<W: Write>(
&self,
writer: W,
options: &XmlWriteOptions
) -> Result<(), Error>
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.
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Value
impl UnwindSafe for Value
Blanket Implementations
Mutably borrows from an owned value. Read more