asap_sketchlib 0.2.1

A high-performance sketching library for approximate stream processing
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Native MessagePack codec impl for [`crate::sketches::kmv::KMV`].

use crate::SketchHasher;
use crate::message_pack_format::{Error, MessagePackCodec};
use crate::sketches::kmv::KMV;

impl<H: SketchHasher> MessagePackCodec for KMV<H> {
    fn to_msgpack(&self) -> Result<Vec<u8>, Error> {
        Ok(self.serialize_to_bytes()?)
    }

    fn from_msgpack(bytes: &[u8]) -> Result<Self, Error> {
        Ok(Self::deserialize_from_bytes(bytes)?)
    }
}