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.

Variants§

§

Ok(T)

Equivalent to Result::Ok.

§

Err(Box<dyn Error + Send + Sync>)

Equivalent to Result::Err.

Trait Implementations§

source§

impl<T: Debug> Debug for GeneratorResult<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<BuildPaths> for GeneratorResult<BuildPaths>

source§

fn from(val: BuildPaths) -> Self

Converts to this type from the input type.
source§

impl From<HeaderMap<HeaderValue>> for GeneratorResult<HeaderMap>

source§

fn from(val: HeaderMap) -> Self

Converts to this type from the input type.
source§

impl<E: Into<Box<dyn Error + Send + Sync + 'static>> + Send + Sync> From<Result<BuildPaths, E>> for GeneratorResult<BuildPaths>

source§

fn from(val: Result<BuildPaths, E>) -> Self

Converts to this type from the input type.
source§

impl<E: Into<Box<dyn Error + Send + Sync + 'static>> + Send + Sync> From<Result<HeaderMap<HeaderValue>, E>> for GeneratorResult<HeaderMap>

source§

fn from(val: Result<HeaderMap, E>) -> Self

Converts to this type from the input type.
source§

impl<S: Serialize + DeserializeOwned + MakeRx, E: Into<Box<dyn Error + Send + Sync + 'static>> + Send + Sync> From<Result<S, E>> for GeneratorResult<S>

source§

fn from(val: Result<S, E>) -> Self

Converts to this type from the input type.
source§

impl<E: Into<Box<dyn Error + Send + Sync + 'static>> + Send + Sync> From<Result<View<SsrNode>, E>> for GeneratorResult<View<SsrNode>>

source§

fn from(val: Result<View<SsrNode>, E>) -> Self

Converts to this type from the input type.
source§

impl<S: Serialize + DeserializeOwned + MakeRx> From<S> for GeneratorResult<S>

source§

fn from(val: S) -> Self

Converts to this type from the input type.
source§

impl From<View<SsrNode>> for GeneratorResult<View<SsrNode>>

source§

fn from(val: View<SsrNode>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for GeneratorResult<T>

§

impl<T> Send for GeneratorResult<T>where T: Send,

§

impl<T> Sync for GeneratorResult<T>where T: Sync,

§

impl<T> Unpin for GeneratorResult<T>where T: Unpin,

§

impl<T> !UnwindSafe for GeneratorResult<T>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.