Expand description
A simple error type backed by a string.
This crate provides a SimpleError type, which implements std::error::Error.
The underlying type is a String used as the error message.
It should be used when all you care about is an error string.
It should not be used when you want to programmatically handle different kinds of an error.
Macros§
- bail
- Helper macro for returning a
SimpleErrorconstructed from either aInto<SimpleError>, a string slice, or a formatted string. - ensure_
with - Helper macro for ensuring a boolean condition while returning early with a
newly constructed
SimpleErrorif the condition isfalse. Can be used in functions that returnResult<_, E>whereE: From<SimpleError>(e.g.SimpleErrororBox<dyn Error>). - map_
err_ with - Map a result type error to simple error with format
- require_
with - Helper macro for unwrapping
Optionvalues while returning early with a newly constructedSimpleErrorif the value of the expression isNone. Can be used in functions that returnResult<_, E>whereE: From<SimpleError>(e.g.SimpleErrororBox<dyn Error>). - simple_
error - Construct an ad-hoc
SimpleErrorfrom a string. - try_
with - Helper macro for unwrapping
Resultvalues while returning early with a newly constructedSimpleErrorif the value of the expression isErr. Can be used in functions that returnResult<_, E>whereE: From<SimpleError>(e.g.SimpleErrororBox<dyn Error>).
Structs§
- Simple
Error - A type that represents a simple error.
Type Aliases§
- Simple
Result - Result type in which the error is a simple error