pub trait Compress:
Sized
+ Send
+ Sync
+ Debug {
type Compressed: BufMut + AsRef<[u8]> + AsMut<[u8]> + Into<Vec<u8>> + Default + Send + Sync + Debug;
// Required method
fn compress_to_buf<B>(self, buf: &mut B)
where B: BufMut + AsMut<[u8]>;
// Provided methods
fn uncompressable_ref(&self) -> Option<&[u8]> { ... }
fn compress(self) -> Self::Compressed { ... }
}
Expand description
Trait that will transform the data to be saved in the DB in a (ideally) compressed format
Required Associated Types§
Required Methods§
fn compress_to_buf<B>(self, buf: &mut B)
fn compress_to_buf<B>(self, buf: &mut B)
Compresses data to a given buffer.
Provided Methods§
fn uncompressable_ref(&self) -> Option<&[u8]>
fn uncompressable_ref(&self) -> Option<&[u8]>
If the type cannot be compressed, return its inner reference as Some(self.as_ref())
fn compress(self) -> Self::Compressed
fn compress(self) -> Self::Compressed
Compresses data going into the database.
Object Safety§
This trait is not object safe.