TryKeyInit

Trait TryKeyInit 

Source
pub trait TryKeyInit: Sized + KeySizeUser {
    // Required method
    fn new(key: &Array<u8, Self::KeySize>) -> Result<Self, InvalidKey>;

    // Provided method
    fn new_from_slice(key: &[u8]) -> Result<Self, InvalidKey> { ... }
}
Expand description

Types which can be fallibly initialized from a key.

Required Methods§

Source

fn new(key: &Array<u8, Self::KeySize>) -> Result<Self, InvalidKey>

Create new value from a fixed-size key.

§Errors
  • if the key is considered invalid according to rules specific to the implementing type

Provided Methods§

Source

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidKey>

Create new value from a variable size key.

§Errors
  • if the provided slice is the wrong length
  • if the key is considered invalid by TryKeyInit::new

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.

Implementations on Foreign Types§

Source§

impl<P> TryKeyInit for EncapsulationKey<P>
where P: KemParams,

Implementors§