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§
Provided Methods§
Sourcefn new_from_slice(key: &[u8]) -> Result<Self, InvalidKey>
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.