pub struct Nonce([u8; 12]);
Expand description
A nonce for a single AEAD opening or sealing operation.
The user must ensure, for a particular key, that each nonce is unique.
Nonce
intentionally doesn’t implement Clone
to ensure that each one is
consumed at most once.
Tuple Fields§
§0: [u8; 12]
Implementations§
source§impl Nonce
impl Nonce
sourcepub fn try_assume_unique_for_key(value: &[u8]) -> Result<Self, Unspecified>
pub fn try_assume_unique_for_key(value: &[u8]) -> Result<Self, Unspecified>
Constructs a Nonce
with the given value, assuming that the value is
unique for the lifetime of the key it is being used with.
Fails if value
isn’t NONCE_LEN
bytes long.
sourcepub fn assume_unique_for_key(value: [u8; 12]) -> Self
pub fn assume_unique_for_key(value: [u8; 12]) -> Self
Constructs a Nonce
with the given value, assuming that the value is
unique for the lifetime of the key it is being used with.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Nonce
impl RefUnwindSafe for Nonce
impl Send for Nonce
impl Sync for Nonce
impl Unpin for Nonce
impl UnwindSafe for Nonce
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more