diff --git a/src/iterator.rs b/src/iterator.rs index 0c1c477..29e19a8 100644 --- a/src/iterator.rs +++ b/src/iterator.rs @@ -1,5 +1,6 @@ use futures::Async; -use ebml::*; +use ebml::Error as EbmlError; +use ebml::FromEbml; use webm::*; pub struct EbmlCursor { @@ -7,8 +8,8 @@ pub struct EbmlCursor { position: usize } -impl EbmlCursor { - pub fn new(source: T) -> Self { +impl EbmlCursor { + pub fn new(source: S) -> Self { EbmlCursor { source, position: 0 @@ -20,7 +21,7 @@ impl<'a> Iterator for EbmlCursor<&'a [u8]> { type Item = WebmElement<'a>; fn next(&mut self) -> Option> { - match Self::Item::decode_element(&self.source[self.position..]) { + match Self::Item::decode_element(&self.source.as_ref()[self.position..]) { Err(_) => None, Ok(None) => None, Ok(Some((element, element_size))) => { @@ -31,10 +32,10 @@ impl<'a> Iterator for EbmlCursor<&'a [u8]> { } } -impl<'b, T: AsRef<[u8]>> WebmEventSource for EbmlCursor { - type Error = Error; +impl<'b, S: AsRef<[u8]>> WebmEventSource for EbmlCursor { + type Error = EbmlError; - fn poll_event<'a>(&'a mut self) -> Result>>, Error> { + fn poll_event<'a>(&'a mut self) -> Result>>, EbmlError> { match WebmElement::decode_element(&self.source.as_ref()[self.position..]) { Err(err) => Err(err), Ok(None) => Ok(Async::Ready(None)),