pub struct Nonce(/* private fields */);
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.
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 12 bytes