mirror of
https://github.com/RustAudio/rodio
synced 2024-11-10 14:14:21 +00:00
Implement Display and Error traits for PlayError
This commit is contained in:
parent
566e979203
commit
5907affb44
1 changed files with 18 additions and 0 deletions
|
@ -85,6 +85,24 @@ impl From<decoder::DecoderError> for PlayError {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for PlayError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::DecoderError(e) => e.fmt(f),
|
||||
Self::NoDevice => write!(f, "NoDevice"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl error::Error for PlayError {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
match self {
|
||||
Self::DecoderError(e) => Some(e),
|
||||
Self::NoDevice => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum StreamError {
|
||||
PlayStreamError(cpal::PlayStreamError),
|
||||
|
|
Loading…
Reference in a new issue