pub struct Data { /* private fields */ }
Expand description
A byte buffer used for serialization to and from the plist data type.
You use it in types with derived Serialize
/Deserialize
traits.
§Examples
extern crate plist;
#[macro_use]
extern crate serde_derive;
#[derive(Deserialize, Serialize)]
struct Info {
blob: plist::Data,
}
let actual = Info { blob: plist::Data::new(vec![1, 2, 3, 4]) };
let mut xml_byte_buffer: Vec<u8> = vec![];
plist::to_writer_xml(&mut xml_byte_buffer, &actual)
.expect("serialize into xml");
let expected: Info = plist::from_reader_xml(xml_byte_buffer.as_slice())
.expect("deserialize from xml");
assert_eq!(actual.blob, expected.blob);
Implementations§
source§impl Data
impl Data
sourcepub fn from_xml_format(b64_str: &str) -> Result<Self, InvalidXmlData>
pub fn from_xml_format(b64_str: &str) -> Result<Self, InvalidXmlData>
Create a Data
object from an XML plist (Base-64) encoded string.
sourcepub fn to_xml_format(&self) -> String
pub fn to_xml_format(&self) -> String
Converts the Data
to an XML plist (Base-64) string.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Data
impl<'de> Deserialize<'de> for Data
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for Data
impl PartialEq for Data
impl Eq for Data
impl StructuralPartialEq for Data
Auto Trait Implementations§
impl Freeze for Data
impl RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl UnwindSafe for Data
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.