Skip to main content

RoundtripTestable

Trait RoundtripTestable 

Source
pub trait RoundtripTestable:
    Serialize
    + for<'de> Deserialize<'de>
    + Clone
    + PartialEq {
    // Provided methods
    fn test_json_roundtrip(&self) -> Result<(), String> { ... }
    fn test_binary_roundtrip(&self) -> Result<(), String> { ... }
}
Expand description

Trait for types that support roundtrip encoding/decoding

Provided Methods§

Source

fn test_json_roundtrip(&self) -> Result<(), String>

Test JSON roundtrip: serialize → deserialize → re-serialize

Source

fn test_binary_roundtrip(&self) -> Result<(), String>

Test binary roundtrip if the type supports binary encoding

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§