Implement Error/Display for AdapterError

This commit is contained in:
Sebastian Dröge 2017-12-20 19:18:32 +02:00
parent a99522150b
commit 8e1428c047

View file

@ -9,6 +9,8 @@
use std::collections::VecDeque;
use std::cmp;
use std::io;
use std::fmt;
use std::error::Error;
use gst;
use gst::prelude::*;
@ -35,6 +37,18 @@ pub enum AdapterError {
NotEnoughData,
}
impl fmt::Display for AdapterError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Not enough data")
}
}
impl Error for AdapterError {
fn description(&self) -> &str {
"Not enough data"
}
}
impl Adapter {
pub fn new() -> Adapter {
Adapter {