Skip to main content

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 key is considered invalid according to rules specific to the implementing type.

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§