[][src]Struct mpd_protocol::response::frame::Frame

pub struct Frame { /* fields omitted */ }

A succesful response to a command.

Consists of zero or more key-value pairs, where the keys are not unique, and optionally a single binary blob.

Implementations

impl Frame[src]

pub fn empty() -> Self[src]

Create an empty frame (0 key-value pairs).

pub fn fields_len(&self) -> usize[src]

Get the number of key-value pairs in this response frame.

pub fn is_empty(&self) -> bool[src]

Returns true if the frame is entirely empty, i.e. contains 0 key-value pairs and no binary blob.

pub fn has_binary(&self) -> bool[src]

Returns true if the frame contains a binary blob.

This will return false after you remove the binary blob using Frame::get_binary.

pub fn fields(&self) -> Fields<'_>

Notable traits for Fields<'a>

impl<'a> Iterator for Fields<'a> type Item = (&'a str, &'a str);
[src]

Returns an iterator over all key-value pairs in this frame, in the order they appear in the response.

If keys have been removed using Frame::get, they will not appear.

pub fn find<K>(&self, key: K) -> Option<&str> where
    K: AsRef<str>, 
[src]

Find the first key-value pair with the given key, and return a reference to its value.

The key is case-sensitive.

pub fn binary(&self) -> Option<&[u8]>[src]

Returns a reference to the binary blob in this frame, if there is one.

If the binary blob has been removed using Frame::get_binary, this will return None.

pub fn get<K>(&mut self, key: K) -> Option<String> where
    K: AsRef<str>, 
[src]

Find the first key-value pair with the given key, and return its value.

The key is case-sensitive. This removes it from the list of fields in this frame.

pub fn get_binary(&mut self) -> Option<BytesMut>[src]

Get the binary blob contained in this frame, if present.

This will remove it from the frame, future calls to this method will return None.

Trait Implementations

impl Clone for Frame[src]

impl Debug for Frame[src]

impl Eq for Frame[src]

impl<'a> IntoIterator for &'a Frame[src]

type Item = (&'a str, &'a str)

The type of the elements being iterated over.

type IntoIter = Fields<'a>

Which kind of iterator are we turning this into?

impl IntoIterator for Frame[src]

type Item = (Arc<str>, String)

The type of the elements being iterated over.

type IntoIter = IntoIter

Which kind of iterator are we turning this into?

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.