Fix formatting and minor restructuring
Fixed formatting using cargo fmt. Change some parser structure to reduce code deduplication
This commit is contained in:
15
src/frame.rs
15
src/frame.rs
@@ -39,7 +39,10 @@ impl<'b> Frame<'b> {
|
||||
Some(self.inner.as_ref())
|
||||
}
|
||||
|
||||
pub fn decompress_with_buf<'s, 'buf>(&'s self, buf: &'b mut Vec<u8>) -> Result<&'buf [u8], ()> where 's: 'buf {
|
||||
pub fn decompress_with_buf<'s, 'buf>(&'s self, buf: &'b mut Vec<u8>) -> Result<&'buf [u8], ()>
|
||||
where
|
||||
's: 'buf,
|
||||
{
|
||||
if !self.compressed {
|
||||
return Ok(&self.inner);
|
||||
}
|
||||
@@ -50,10 +53,12 @@ impl<'b> Frame<'b> {
|
||||
})?;
|
||||
buf.resize(uncompressed_len, 0);
|
||||
|
||||
snap::raw::Decoder::new().decompress(&self.inner, buf.as_mut_slice()).map_err(|e| {
|
||||
println!("Decompressing");
|
||||
()
|
||||
})?;
|
||||
snap::raw::Decoder::new()
|
||||
.decompress(&self.inner, buf.as_mut_slice())
|
||||
.map_err(|e| {
|
||||
println!("Decompressing");
|
||||
()
|
||||
})?;
|
||||
|
||||
Ok(buf.as_slice())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user