Possible errors (detectable during initialisation, i.e. only applicable to new() methods):
- Failure to open random device (e.g.
/dev/urandom)
- Insufficient entropy (system not ready)
Possible errors (at any time, thus affecting new(), next_* and try_fill()):
- Interrupt by user (Ctrl+C)
- Hardware/external generator failure or disconnection
- PRNG cycle
- "Entropy exhaustion": PRNGs with artificially limited output (hypothetical and not needed even for periodic reseeding; suggested here)
Proposed error kinds:
/// Error kind which can be matched over.
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
pub enum ErrorKind {
/// Permanent failure: likely not recoverable without user action.
Unavailable,
/// Temporary failure: recommended to retry a few times, but may also be
/// irrecoverable.
Transient,
/// Not ready yet: recommended to try again a little later.
NotReady,
/// Uncategorised error
Other,
// no hidden members: allow exclusive match
}
References:
Possible errors (detectable during initialisation, i.e. only applicable to
new()methods):/dev/urandom)Possible errors (at any time, thus affecting
new(),next_*andtry_fill()):Proposed error kinds:
References: