Skip to main content

NewLockedFromSlice

Trait NewLockedFromSlice 

Source
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§

Source

fn from_slice_into_locked( src: &[u8], ) -> Result<Protected<A, ReadWrite, Locked>, Error>

Returns a new locked region of memory from src.

§Errors

Returns an error if src has the wrong length for a fixed-size output or the pages cannot be locked.

§Panics

May panic if allocating or resizing the protected storage fails, including when the requested size cannot be rounded to whole pages.

Source

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".

Implementors§