KeySlice

Struct KeySlice 

Source
pub struct KeySlice<'k, SZ: KeySz> { /* private fields */ }
Expand description

Represents a key for the associated hashing algorithm which has a length greater than or equal to the length of the hash function’s digest.

Implementations§

Source§

impl<'k, SZ: KeySz> KeySlice<'k, SZ>

Source

pub fn new(slice: &'k [u8]) -> Result<Self, InvalidSize>

Try creating a new KeySlice instance.

§Errors
  • If the length of the slice is less than the SZ::size.
  • If the length of the slice is greater than u32::MAX.

Trait Implementations§

Source§

impl<'k, SZ: KeySz> GenericKey for KeySlice<'k, SZ>

Source§

type Size = SZ

The desired size of the key.
Source§

fn size(&self) -> u32

Returns the size of the key in bytes.
Source§

fn cleanup(self)

Zeroes the memory of the key if is owned.
Source§

impl<'k, SZ: KeySz> TryFrom<&'k [u8]> for KeySlice<'k, SZ>

Source§

fn try_from(value: &'k [u8]) -> Result<Self, Self::Error>

Try creating a new KeySlice instance.

§Errors
  • If the length of the slice is less than the SZ::size.
  • If the length of the slice is greater than u32::MAX.
Source§

type Error = InvalidSize

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl<'k, SZ> Freeze for KeySlice<'k, SZ>

§

impl<'k, SZ> RefUnwindSafe for KeySlice<'k, SZ>
where SZ: RefUnwindSafe,

§

impl<'k, SZ> Send for KeySlice<'k, SZ>
where SZ: Send,

§

impl<'k, SZ> Sync for KeySlice<'k, SZ>
where SZ: Sync,

§

impl<'k, SZ> Unpin for KeySlice<'k, SZ>
where SZ: Unpin,

§

impl<'k, SZ> UnwindSafe for KeySlice<'k, SZ>
where SZ: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.