pub enum SecretError {
EntropyUnavailable,
EntropyUnsupported,
Rejected,
}Expand description
A source of unguessable values could not produce one.
The variants exist to separate the two failures a caller has to tell apart.
A source that cannot reach the operating system’s entropy is an environment
problem, fixed by restarting or by moving somewhere the source exists;
Rejected means this crate’s own encoder produced a
value its own value object refused, which is an internal invariant and a bug
here. One unit error for both would make the second indistinguishable from
the first, and the second is the one worth a bug report.
Variants§
The operating system’s entropy source could not be read.
EntropyUnsupported
This platform provides no usable entropy source.
Rejected
The value drawn was refused by the value object that owns it.
An adapter drawing 32 bytes and encoding them base64url produces 43 characters drawn from a subset of the unreserved set, so it cannot fail the length or charset rule it is checked against. Reaching this variant means the encoding and that rule have diverged.
Trait Implementations§
Source§impl Clone for SecretError
impl Clone for SecretError
impl Copy for SecretError
Source§impl Debug for SecretError
impl Debug for SecretError
Source§impl Display for SecretError
impl Display for SecretError
impl Eq for SecretError
Source§impl Error for SecretError
impl Error for SecretError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()