concordium_base 10.0.0-alpha.0

A library that defines common types and functionality that are needed by Concordium Rust projects.
Documentation
1
2
3
4
5
6
7
8
9
10
/// A simple function that serializes and then immediately deserializes a value.
/// This should always return Ok(v) where `v` is equivalent to the given
/// argument. Used for testing.
#[cfg(test)]
pub fn serialize_deserialize<A: super::Serialize>(x: &A) -> super::ParseResult<A> {
    use std::io::Cursor;
    let mut buf = Vec::<u8>::new();
    x.serial(&mut buf);
    A::deserial(&mut Cursor::new(buf))
}