Enum perseus::template::GeneratorResult
source · pub enum GeneratorResult<T> {
Ok(T),
Err(Box<dyn Error + Send + Sync>),
}
Expand description
A custom enum
representation of a Result
-style type whose error is a
Box
that can accept any thread-safe error type. This is used internally as
a conversion type so that your state generation functions (e.g.
get_build_state
) can return either some type T
, or a Result<T, E>
,
where E
is of your choosing. This type appears as
Into<GeneratorResult<T>>
in several function signatures, and that
From
/Into
relation is automatically implemented for all the types you’ll
need in your state generation functions.
You can think of this as another way of implementing a MaybeFallible
trait, which would be more elegant, but doesn’t work yet due to the overlap
between T
and Result<T, E>
(which could itself be interpreted as T
).
Until certain nightly features of Rust as stabilized, this is not possible
without copious type parameter specification.
You should never need to use this type yourself, consider it an internal conversion type.