polytune 0.2.0-alpha.4

Maliciously-Secure Multi-Party Computation (MPC) Engine using Authenticated Garbling
Documentation
1
2
3
4
5
6
7
8
9
10
use bincode::error::{DecodeError, EncodeError};
use serde::{Serialize, de::DeserializeOwned};

pub(crate) fn serialize<T: Serialize>(val: T) -> Result<Vec<u8>, EncodeError> {
    bincode::serde::encode_to_vec(val, bincode::config::legacy())
}

pub(crate) fn deserialize<T: DeserializeOwned>(slice: &[u8]) -> Result<T, DecodeError> {
    bincode::serde::decode_from_slice(slice, bincode::config::legacy()).map(|(val, _)| val)
}