[−][src]Struct mpd_protocol::response::Response
Response to a command, consisting of an abitrary amount of frames, which are responses to individual commands, and optionally a single error.
Since an error terminates a command list, there can only be one error in a response.
Fields
frames: Vec<Frame>
The sucessful responses.
error: Option<Error>
The error, if one occured.
Methods
impl Response
[src]
pub fn new(frames: Vec<Frame>, error: Option<Error>) -> Self
[src]
Construct a new response.
use mpd_protocol::response::{Response, Frame}; let r = Response::new(vec![Frame::default()], None); assert_eq!(1, r.frames.len()); assert!(r.error.is_none());
Panics
Panics if it is attempted to construct an empty response (i.e. both frames
and error
are empty). This should not occur during normal operation.
use mpd_protocol::response::Response; // This panics: Response::new(Vec::new(), None);
pub fn empty() -> Self
[src]
Construct a new "empty" response. This is the simplest possible succesful response, consisting of a single empty frame.
use mpd_protocol::response::Response; let r = Response::empty(); assert_eq!(1, r.frames.len()); assert_eq!(None, r.error);
pub fn is_error(&self) -> bool
[src]
Returns true
if the response resulted in an error.
use mpd_protocol::response::{Response, Error}; let r = Response::new(Vec::new(), Some(Error::default())); assert!(r.is_error());
pub fn is_success(&self) -> bool
[src]
Returns true
if the response was entirely succesful (i.e. no errors).
use mpd_protocol::response::{Response, Frame}; let r = Response::new(vec![Frame::default()], None); assert!(r.is_success());
Trait Implementations
impl Eq for Response
[src]
impl PartialEq<Response> for Response
[src]
impl Debug for Response
[src]
impl StructuralPartialEq for Response
[src]
impl StructuralEq for Response
[src]
Auto Trait Implementations
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
impl RefUnwindSafe for Response
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,