mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-07-03 00:22:12 +00:00
tests for data ser/de
This commit is contained in:
@ -85,4 +85,10 @@ pub fn deserialize_file<P: AsRef<::std::path::Path>>(p: P) -> Result<Module, Err
|
||||
pub fn deserialize_buffer<T: Deserialize>(contents: Vec<u8>) -> Result<T, T::Error> {
|
||||
let mut reader = io::Cursor::new(contents);
|
||||
T::deserialize(&mut reader)
|
||||
}
|
||||
|
||||
pub fn serialize<T: Serialize>(val: T) -> Result<Vec<u8>, T::Error> {
|
||||
let mut buf = Vec::new();
|
||||
val.serialize(&mut buf)?;
|
||||
Ok(buf)
|
||||
}
|
Reference in New Issue
Block a user