pub trait NewLockedFromSlice<A: Zeroize + NewBytes + Lockable<A>> {
// Required methods
fn from_slice_into_locked(
src: &[u8],
) -> Result<Protected<A, ReadWrite, Locked>, Error>;
fn from_slice_into_readonly_locked(
src: &[u8],
) -> Result<Protected<A, ReadOnly, Locked>, Error>;
}Available on crate feature
protected only.Expand description
Create a new region of protected memory from a slice.
Required Methods§
Sourcefn from_slice_into_readonly_locked(
src: &[u8],
) -> Result<Protected<A, ReadOnly, Locked>, Error>
fn from_slice_into_readonly_locked( src: &[u8], ) -> Result<Protected<A, ReadOnly, Locked>, Error>
Returns a new read-only locked region of memory from src.
§Errors
Returns an error if src has the wrong length for a fixed-size output,
its pages cannot be locked, or its page permissions cannot be changed
to read-only.
§Panics
May panic if allocating or resizing the protected storage fails, including when the requested size cannot be rounded to whole pages.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".