secure_gate/traits/cloneable_type.rs
1//! Marker trait for opt-in safe cloning with zeroization.
2
3/// Implement this trait on types that require safe duplication while maintaining
4/// security guarantees. The trait itself is a marker and does not provide methods,
5/// but implementations must ensure proper zeroization.
6///
7/// # Examples
8///
9/// ```rust
10/// #[cfg(feature = "cloneable")]
11/// {
12/// use secure_gate::{CloneableType, Fixed};
13///
14/// #[derive(Clone)]
15/// struct MyKey([u8; 32]);
16///
17/// impl CloneableType for MyKey {} // Opt-in to safe cloning
18///
19/// let key: Fixed<MyKey> = Fixed::new(MyKey([0; 32]));
20/// let copy = key.clone(); // Now allowed, with zeroization on drop
21/// }
22/// ```
23#[cfg(feature = "cloneable")]
24pub trait CloneableType: Clone {}