1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::protocol::buf::{ByteBuf, ByteBufMut};
use crate::protocol::{EncodeError, DecodeError};
use super::{Compressor, Decompressor};
pub struct None;
impl<B: ByteBufMut> Compressor<B> for None {
type BufMut = B;
fn compress<R, F>(buf: &mut B, f: F) -> Result<R, EncodeError>
where
F: FnOnce(&mut Self::BufMut) -> Result<R, EncodeError>
{
f(buf)
}
}
impl<B: ByteBuf> Decompressor<B> for None {
type Buf = B;
fn decompress<R, F>(buf: &mut B, f: F) -> Result<R, DecodeError>
where
F: FnOnce(&mut Self::Buf) -> Result<R, DecodeError>
{
f(buf)
}
}