Enum Error

Source
#[non_exhaustive]
pub enum Error { InvalidConfig { message: String, config: Value, }, NoSuchVariable(String), IncorrectVariableType { name: String, expected_type: String, }, CouldNotLoad { expected_type: String, config: Value, }, AllVariantsFailed { config: Value, errors: Vec<Error>, }, BlueprintNotFound(String), BlueprintFailed(String, Box<Error>), MakerFailed(String), ResolveFailed { var_failure: Box<Error>, config_failure: Box<Error>, }, }
Expand description

Error during config parsing.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidConfig

The configuration was invalid.

Fields

§message: String

Description of the issue

§config: Value

Optional offending config object

§

NoSuchVariable(String)

Found no variable with the given name.

§

IncorrectVariableType

Found a variable, but with a different type than expected.

Fields

§name: String

Name of the offending variable

§expected_type: String

Expected type

§

CouldNotLoad

Could not load the given config.

Fields

§expected_type: String

Expected type

§config: Value

Config value that could not be parsed

§

AllVariantsFailed

All variants from a multi-variant blueprint failed.

Fields

§config: Value

Config value that could not be parsed

§errors: Vec<Error>

List of errors for the blueprint variants.

§

BlueprintNotFound(String)

A blueprint was not found

§

BlueprintFailed(String, Box<Error>)

A blueprint failed to run.

This is in direct cause to an error in an actual blueprint.

§

MakerFailed(String)

A maker failed to produce a value.

§

ResolveFailed

We failed to resolve a value.

It means we failed to load it as a variable, and also failed to load it as a config.

Fields

§var_failure: Box<Error>

Failure while resolving the value as a variable.

§config_failure: Box<Error>

Failure while resolving the value as a config.

Implementations§

Source§

impl Error

Source

pub fn invalid_config<S, C>(message: S, config: &C) -> Error
where S: Into<String>, C: Clone + Into<Value>,

Convenient method to create an error from a message and a problematic config.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> With for T

Source§

fn wrap_with<U, F>(self, f: F) -> U
where F: FnOnce(Self) -> U,

Calls the given closure and return the result. Read more
Source§

fn with<F>(self, f: F) -> Self
where F: FnOnce(&mut Self),

Calls the given closure on self.
Source§

fn try_with<E, F>(self, f: F) -> Result<Self, E>
where F: FnOnce(&mut Self) -> Result<(), E>,

Calls the given closure on self.
Source§

fn with_if<F>(self, condition: bool, f: F) -> Self
where F: FnOnce(&mut Self),

Calls the given closure if condition == true.