Struct rand::Error
[−]
[src]
pub struct Error { /* fields omitted */ }
Error type of random number generators
This is a relatively simple error type, designed for compatibility with and
without the Rust std
library. It embeds a "kind" code, a message (static
string only), and an optional chained cause (std
only).
Methods
impl Error
[src]
pub fn new(kind: ErrorKind, msg: &'static str) -> Self
[src]
Create a new instance, with specified kind and a message.
pub fn with_cause<E>(kind: ErrorKind, msg: &'static str, cause: E) -> Self where
E: Into<Box<stdError + Send + Sync>>,
[src]
E: Into<Box<stdError + Send + Sync>>,
Create a new instance, with specified kind, message, and a chained cause.
Note: stdError
is an alias for std::error::Error
.
If not targetting std
(i.e. no_std
), this function is replaced by
another with the same prototype, except that there are no bounds on the
type E
(because both Box
and stdError
are unavailable), and the
cause
is ignored.
pub fn kind(&self) -> ErrorKind
[src]
Get the error kind
pub fn msg(&self) -> &'static str
[src]
Get the error message
Trait Implementations
impl From<TimerError> for Error
[src]
fn from(err: TimerError) -> Error
[src]
Performs the conversion.
impl Debug for Error
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Display for Error
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more