pub trait ProtectedInitSlice:
ExposeProtected<Target = [Self::Item]>
+ From<SecureBox<[Self::Item]>>
+ Sized {
type Item;
// Provided methods
fn init_slice<F>(len: usize, f: F) -> Self
where F: FnOnce(SecureRef<&mut [Self::Item]>),
Self::Item: Copy + FillBytes { ... }
fn init_default_slice<F>(len: usize, f: F) -> Self
where F: FnOnce(SecureRef<&mut [Self::Item]>),
Self::Item: Default { ... }
fn init_random_slice<F>(len: usize, rng: impl RngCore, f: F) -> Self
where F: FnOnce(SecureRef<&mut [Self::Item]>),
Self::Item: Copy + FillBytes { ... }
fn init_take_slice<F>(from: &mut [Self::Item], f: F) -> Self
where F: FnOnce(SecureRef<&mut [Self::Item]>),
Self::Item: DefaultIsZeroes { ... }
fn random_slice(len: usize, rng: impl RngCore) -> Self
where Self::Item: Copy + FillBytes { ... }
fn take_slice(from: &mut [Self::Item]) -> Self
where Self::Item: DefaultIsZeroes { ... }
}
Expand description
Initialize a protected container type for a slice of elements.
Required Associated Types§
Provided Methods§
Sourcefn init_slice<F>(len: usize, f: F) -> Self
fn init_slice<F>(len: usize, f: F) -> Self
For a concrete type implementing FillBytes
, initialize a slice
of length len
with the standard indicator value and call the closure
f
with a mutable reference to the slice before applying protections.
Sourcefn init_default_slice<F>(len: usize, f: F) -> Self
fn init_default_slice<F>(len: usize, f: F) -> Self
Initialize with a slice of length len
containing the default value for
Self::Item
, and call the closure f
with a mutable reference to the
slice before applying protections.
Sourcefn init_random_slice<F>(len: usize, rng: impl RngCore, f: F) -> Self
fn init_random_slice<F>(len: usize, rng: impl RngCore, f: F) -> Self
Initialize with a randomized slice of length len
, and call the
closure f
with a mutable reference to the slice before
applying protections.
Sourcefn init_take_slice<F>(from: &mut [Self::Item], f: F) -> Self
fn init_take_slice<F>(from: &mut [Self::Item], f: F) -> Self
Initialize by copying the slice from
and zeroizing the existing
copy. Call the closure f
with a mutable reference to the contained
slice before applying protections.
Sourcefn random_slice(len: usize, rng: impl RngCore) -> Self
fn random_slice(len: usize, rng: impl RngCore) -> Self
Create a new protected instance containing a random slice of length len
.
Sourcefn take_slice(from: &mut [Self::Item]) -> Selfwhere
Self::Item: DefaultIsZeroes,
fn take_slice(from: &mut [Self::Item]) -> Selfwhere
Self::Item: DefaultIsZeroes,
Create a new protected slice instance by copying and zeroizing an existing slice.
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.