mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 17:41:05 +00:00
Implement Display and Error for IteratorError
This commit is contained in:
parent
7065d1d884
commit
f7c971874d
1 changed files with 20 additions and 0 deletions
|
@ -21,6 +21,8 @@ use std::sync::Arc;
|
|||
use std::ffi::CString;
|
||||
use std::marker::PhantomData;
|
||||
use std::iter::Iterator as StdIterator;
|
||||
use std::fmt;
|
||||
use std::error::Error;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
|
||||
pub enum IteratorError {
|
||||
|
@ -28,6 +30,24 @@ pub enum IteratorError {
|
|||
Error,
|
||||
}
|
||||
|
||||
impl fmt::Display for IteratorError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
IteratorError::Resync => write!(f, "Resync"),
|
||||
IteratorError::Error => write!(f, "Error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for IteratorError {
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
IteratorError::Resync => "Resync",
|
||||
IteratorError::Error => "Error",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Implemented manually so that we can use generics for the item
|
||||
pub struct Iterator<T> {
|
||||
iter: *mut ffi::GstIterator,
|
||||
|
|
Loading…
Reference in a new issue