pub trait PSRoundTrip{
// Required method
proof fn theorem_parse_serialize_roundtrip(&self, ibuf: Seq<u8>);
// Provided methods
open spec fn ps_roundtrip_inv(&self) -> bool { ... }
fn corollary_parse_non_malleable(&self, buf1: Seq<u8>, buf2: Seq<u8>) { ... }
}Expand description
Parse-serialize roundtrip.
Parsing a buffer and serializing the result reproduces the consumed bytes.
Automatically derived for combinators implementing SPRoundTrip + NonMalleable.
User-defined combinators can also prove this directly.
Required Methods§
Sourceproof fn theorem_parse_serialize_roundtrip(&self, ibuf: Seq<u8>)
proof fn theorem_parse_serialize_roundtrip(&self, ibuf: Seq<u8>)
requires
self.ps_roundtrip_inv(),ensuresself.spec_parse(ibuf) matches Some((n, v)) ==> self.spec_serialize(v) == ibuf[0..n],Provided Methods§
Sourceopen spec fn ps_roundtrip_inv(&self) -> bool
open spec fn ps_roundtrip_inv(&self) -> bool
{ true }Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".