Skip to main content

SerializableType

Trait SerializableType 

Source
pub trait SerializableType: Serialize { }
Expand description

Implement this on types that can be deliberately serialized while maintaining security. The trait itself is a marker and does not provide methods, but implementations must ensure that serialization does not leak secrets unintentionally.

§Examples

use secure_gate::SerializableType;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct MySecret {
    data: Vec<u8>,
}

impl SerializableType for MySecret {}

// Now MySecret can be serialized securely, as it's marked with SerializableType

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§