From 413f7759c6704eeb68916dbd71a3f6efcb764c8d Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Tue, 3 Apr 2018 22:06:09 -0400 Subject: [PATCH] Make the buffer generic --- src/webm_stream.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webm_stream.rs b/src/webm_stream.rs index 55d8e6e..b9124a1 100644 --- a/src/webm_stream.rs +++ b/src/webm_stream.rs @@ -26,13 +26,13 @@ impl, S: Stream> WebmBuffer { } } - pub fn poll_event<'a>(&'a mut self) -> Result>>, ParsingError> { + pub fn poll_event<'a, T: FromEbml<'a>>(&'a mut self) -> Result>, ParsingError> { // release buffer from previous event self.buffer.advance(self.last_read); self.last_read = 0; loop { - match WebmElement::check_space(&self.buffer) { + match T::check_space(&self.buffer) { Err(err) => { return Err(ParsingError::EbmlError(err)) }, @@ -40,7 +40,7 @@ impl, S: Stream> WebmBuffer { // need to refill buffer, below }, Ok(Some(_)) => { - return match WebmElement::decode_element(&self.buffer) { + return match T::decode_element(&self.buffer) { Err(err) => { Err(ParsingError::EbmlError(err)) },