Skip to content
CryoCryo home
Stdlibrandom

error

import std::random::error; · source

Types

RandomError

type enum RandomError {
    EntropyUnavailable;
    EmptyRange;
    InvalidWeights;
}

implement enum RandomError {
    describe(&this) -> Str;
    rank(&this) -> i32;
}

Every fallible call in the module — a bounded draw, a weighted table, the entropy source itself — reports one of these.

Variants

Variant
EntropyUnavailable
EmptyRange
InvalidWeights

Methods

describe(&this) -> Str;

A short, stable description of the failure, as a borrowed Str. The convergent accessor every stdlib error type exposes (describe(&this) -> Str); Display/Debug for RandomError delegate to it. Borrows a static string literal, so the view outlives any RandomError.

rank(&this) -> i32;

Discriminant rank, for equality.

Trait implementations

implement trait Eq for enum RandomError
implement trait Display for enum RandomError
std::fmt::display
implement trait Debug for enum RandomError
std::fmt::display