[−][src]Struct mpd_protocol::response::Frame
Data in a succesful response.
Fields
values: Vec<(String, String)>
Key-value pairs. Keys can repeat arbitrarily often.
binary: Option<Vec<u8>>
Binary frame.
Methods
impl Frame
[src]
pub fn empty() -> Self
[src]
Create an empty frame (0 key-value pairs).
use mpd_protocol::response::Frame; let f = Frame::empty(); assert_eq!(0, f.values.len()); assert!(f.binary.is_none());
pub fn values_as_map(&self) -> HashMap<&str, Vec<&str>>
[src]
Collect the key-value pairs in this resposne into a HashMap
.
Beware that this loses the order relationship between different keys. Values for a given key are ordered like they appear in the response.
use mpd_protocol::response::Frame; let f = Frame { values: vec![ (String::from("foo"), String::from("bar")), (String::from("hello"), String::from("world")), (String::from("foo"), String::from("baz")), ], binary: None, }; let map = f.values_as_map(); assert_eq!(map.get("foo"), Some(&vec!["bar", "baz"])); assert_eq!(map.get("hello"), Some(&vec!["world"]));
Trait Implementations
impl Clone for Frame
[src]
impl Debug for Frame
[src]
impl Eq for Frame
[src]
impl PartialEq<Frame> for Frame
[src]
impl StructuralEq for Frame
[src]
impl StructuralPartialEq for Frame
[src]
Auto Trait Implementations
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnwindSafe for Frame
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,