Struct seckey::TempKey
[−]
[src]
pub struct TempKey<'a, T: ?Sized + 'static>(_);
Temporary Key
use seckey::TempKey; let mut key = [8u8; 8]; let key = TempKey::new(&mut key); assert_eq!(key, [8u8; 8]); assert_ne!(key, [1u8; 8]); let mut key2 = [8u8; 8]; assert_eq!(key, TempKey::new(&mut key2));
Note
- It will zero the value when
Drop. - It will refuse to accept if
Tis reference or pointer, to avoid causing null pointer. - It is a reference, to avoid it from being affected by stack copy (return value).
Methods
impl<'a, T: ?Sized + Copy> TempKey<'a, T>[src]
impl<'a, T: Sized> TempKey<'a, T>[src]
impl<'a, T: ?Sized + Copy> TempKey<'a, [T]>[src]
fn from_slice(t: &'a mut [T]) -> TempKey<'a, [T]>[src]
impl<'a, T: Sized> TempKey<'a, [T]>[src]
fn try_from_slice(t: &'a mut [T]) -> Result<TempKey<'a, [T]>, NeedsDrop>[src]
impl<'a> TempKey<'a, str>[src]
Trait Implementations
impl<'a, T: ?Sized> Deref for TempKey<'a, T>[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T[src]
Dereferences the value.
impl<'a, T: ?Sized> DerefMut for TempKey<'a, T>[src]
impl<'a, T: ?Sized> Debug for TempKey<'a, T>[src]
impl<'a, T: ?Sized> PartialEq<T> for TempKey<'a, T>[src]
fn eq(&self, rhs: &T) -> bool[src]
Constant time eq
NOTE: it compare memory value.
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl<'a, 'b, T: Sized> PartialEq<TempKey<'b, T>> for TempKey<'a, T>[src]
fn eq(&self, rhs: &TempKey<T>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl<'a, T: Sized> Eq for TempKey<'a, T>[src]
impl<'a, T: ?Sized> PartialOrd<T> for TempKey<'a, T>[src]
fn partial_cmp(&self, rhs: &T) -> Option<Ordering>[src]
Constant time cmp
NOTE: it compare memory value.
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<'a, 'b, T: Sized> PartialOrd<TempKey<'b, T>> for TempKey<'a, T>[src]
fn partial_cmp(&self, rhs: &TempKey<T>) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<'a, T: Sized> Ord for TempKey<'a, T>[src]
fn cmp(&self, rhs: &TempKey<T>) -> Ordering[src]
This method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.22.0[src]
Compares and returns the minimum of two values. Read more