struct_db 0.4.6

Drop-in embedded database
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
pub fn bincode_encode_to_vec<T>(value: &T) -> Option<Vec<u8>>
where
    T: serde::Serialize,
{
    bincode::serde::encode_to_vec(value, bincode::config::standard()).ok()
}

pub fn bincode_decode_from_slice<T>(slice: &[u8]) -> Option<(T, usize)>
where
    T: serde::de::DeserializeOwned,
{
    bincode::serde::decode_from_slice(slice, bincode::config::standard()).ok()
}