added raw method to RlpStream. usefull for quicklookup

This commit is contained in:
debris 2015-12-12 15:57:08 +01:00
parent 38f813a5e6
commit 6bc56ad004
2 changed files with 6 additions and 0 deletions

View File

@ -101,6 +101,10 @@ impl Stream for RlpStream {
self.unfinished_lists.len() == 0 self.unfinished_lists.len() == 0
} }
fn raw(&self) -> &[u8] {
&self.encoder.bytes
}
fn out(self) -> Vec<u8> { fn out(self) -> Vec<u8> {
match self.is_finished() { match self.is_finished() {
true => self.encoder.out().to_vec(), true => self.encoder.out().to_vec(),

View File

@ -282,6 +282,8 @@ pub trait Stream: Sized {
/// } /// }
fn is_finished(&self) -> bool; fn is_finished(&self) -> bool;
fn raw(&self) -> &[u8];
/// Streams out encoded bytes. /// Streams out encoded bytes.
/// ///
/// panic! if stream is not finished. /// panic! if stream is not finished.