Struct libpulse_binding::proplist::Proplist
[−]
[src]
pub struct Proplist {
pub ptr: *mut ProplistInternal,
// some fields omitted
}A property list object. Basically a dictionary with ASCII strings as keys and arbitrary data as values. This acts as a safe Rust wrapper for the actual C object.
Fields
ptr: *mut ProplistInternal
The actual C object.
Methods
impl Proplist[src]
fn new() -> Option<Self>[src]
Allocate a property list.
fn new_from_string(s: &str) -> Option<Self>[src]
Allocate a new property list and assign key/value from a human readable string.
fn from_raw(ptr: *mut ProplistInternal) -> Self[src]
Create a new Proplist from an existing ProplistInternal
pointer.
fn from_raw_weak(ptr: *mut ProplistInternal) -> Self[src]
Create a new Proplist from an existing ProplistInternal
pointer. This is the 'weak' version, for use in callbacks, which avoids destroying the
internal object when dropped.
fn key_is_valid(key: &str) -> bool[src]
Returns true if the key is valid.
fn sets(&self, key: &str, value: &str) -> Result<(), ()>[src]
Append a new string entry to the property list, possibly overwriting an already existing entry with the same key. An internal copy is made of the provided string.
fn setp(&self, pair: &str) -> Result<(), ()>[src]
Append a new string entry to the property list, possibly overwriting an already existing entry with the same key.
This is similar to sets, however here the provided key and value are
combined into a single string, separated by an =. An internal copy is made of the provided
string.
fn set(&self, key: &str, data: &[u8]) -> Result<(), ()>[src]
Append a new arbitrary data entry to the property list, possibly overwriting an already existing entry with the same key. An internal copy of the provided data is made.
fn gets(&self, key: &str) -> Option<String>[src]
Return a string entry for the specified key. Will return None if the key does not exist or
if data is not valid UTF-8.
fn get(&self, key: &str) -> Option<&[u8]>[src]
Get the value for the specified key.
For string entries, the value store will be NUL-terminated. The caller should make a copy of the data before the property list is accessed again.
Returns a slice formed from the data pointer and the length of the data.
Returns None if key does not exist.
fn merge(&self, other: &Self, mode: UpdateMode)[src]
Merge property list "other" into self, adhering to the merge mode specified.
fn unset(&self, key: &str) -> Result<(), i32>[src]
Removes a single entry from the property list, identified by the specified key name.
fn unset_many(&self, keys: &[&str]) -> Option<u32>[src]
Similar to unset but takes an array of keys to remove.
Returns None on failure, otherwise the number of entries actually removed (which might
even be 0, if there were no matching entries to remove).
fn iterate(&self) -> Option<String>[src]
Used for iterating through the property list.
This function should be called in a loop until it returns None which signifies EOL. On
each loop, the key of an entry is returned. The property list should not be modified during
iteration through the list, with the exception of deleting the current entry. The keys in
the property list do not have any particular order.
while let Some(key) = my_props.iterate() { //do something with it }
fn to_string(&self) -> Option<String>[src]
Format the property list nicely as a human readable string.
This works very much like to_string_sep and uses a newline as
separator and appends one final one.
fn to_string_sep(&self, sep: &str) -> Option<String>[src]
Format the property list nicely as a human readable string, choosing the separator used.
fn contains(&self, key: &str) -> Option<bool>[src]
Returns true if an entry for the specified key exists in the property list. Returns None
on error.
fn clear(&self)[src]
Remove all entries from the property list object.
fn len(&self) -> u32[src]
Returns the number of entries in the property list.
fn is_empty(&self) -> bool[src]
Returns true when the proplist is empty, false otherwise
fn equal_to(&self, to: &Self) -> bool[src]
Returns true when self and to have the same keys and values.