TryKeyInit

Trait TryKeyInit 

Source
pub trait TryKeyInit: KeySizeUser + Sized {
    // Required method
    fn new(key: &Key<Self>) -> 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: &Key<Self>) -> 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.

Implementors§