pub struct Nonce { /* private fields */ }
Expand description

A type that represents a Nonce that XChaCha20 and XChaCha20Poly1305 use.

Exceptions:

An exception will be thrown if:

  • slice is not 24 bytes.
  • The OsRng fails to initialize or read from its source.

Implementations§

Make an object from a given byte slice.

Return the object as byte slice.

Randomly generate using a CSPRNG. Not available in no_std context.

Return the length of the object.

Trait Implementations§

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.