native_db_32bit/
serialization.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn bincode_encode_to_vec<T>(value: &T) -> Option<Vec<u8>>
where
    T: serde::Serialize + native_model::Model,
{
    native_model::encode(value).ok()
}

pub fn bincode_decode_from_slice<T>(slice: &[u8]) -> Option<(T, usize)>
where
    T: serde::de::DeserializeOwned + native_model::Model,
{
    let (data, _) = native_model::decode(slice.to_vec()).ok()?;
    Some((data, 0))
}