Enum ConfigError

Source
pub enum ConfigError {
Show 17 variants SyntaxError(RecognizerError), NotLoaded, MappingExpected, StringExpected(Location), DuplicateKey(String, Location, Location), BadFilePath(String), FileNotFound(String), FileReadFailed(String), NoContext, UnknownVariable(String, Location), NotPresent(String, Option<Location>), InvalidPath(RecognizerError), InvalidPathOperand(Location), IndexOutOfRange(i64, Location), EvaluationFailed(Location), ConversionError(String), CircularReferenceError(Vec<(String, Location)>),
}
Expand description

This is the type of error returned from the high-level API for CFG configurations.

Variants§

§

SyntaxError(RecognizerError)

This error is returned if the configuration text couldn’t be parsed as valid CFG source. The underlying parser error is returned, which should contain location information.

§

NotLoaded

This error is returned if an attempt is made to query a configuration into which nothing has been loaded.

§

MappingExpected

This error is returned if a file loaded as a top-level configuration is not a mapping or mapping body.

§

StringExpected(Location)

This error is returned if a string was expected, but not found. The location where it was expected is returned. This might be the location of an @ operator, whose operand must be a string be cause it represents the path to a file to be included as a sub-configuration.

§

DuplicateKey(String, Location, Location)

This error is returned if a duplicate key is found when parsing a configuration. The key, the duplicate location and the original location are returned.

§

BadFilePath(String)

This error is returned if a specified path is invalid (e.g. couldn’t be canonocalized). The offending path is provided.

§

FileNotFound(String)

This error is returned if a file couldn’t be found. The path that couldn’t be found is provided.

§

FileReadFailed(String)

This error is returned if a file couldn’t be opened for reading. The path that couldn’t be read is provided.

§

NoContext

This error is returned if an identifier is seen, but no lookup context has been provided.

§

UnknownVariable(String, Location)

This error is returned if an identifier is not a key in a specified lookup context.

§

NotPresent(String, Option<Location>)

This error is returned if a key is not present in a configuration or path therein. If the absence is in a path, the location within that path is returned, along with the missing key.

§

InvalidPath(RecognizerError)

This error is returned if a string couldn’t be parsed as a valid path. The underlying parser error is returned, which will include location information.

§

InvalidPathOperand(Location)

This error is returned if a path operand isn’t valid for the current container (e.g. string index for a list, or numeric index for a mapping). The source location where the error occurred are returned.

§

IndexOutOfRange(i64, Location)

This error is returned if an index value is out of range. The bad index value and the source location where it was found are returned.

§

EvaluationFailed(Location)

This error is returned if an evaluation failed. A source location near to where the failure occurred is returned.

§

ConversionError(String)

This error is returned if a special string (back-tick string) couldn’t be converted. The special string which couldn’t be handled is returned.

§

CircularReferenceError(Vec<(String, Location)>)

This error is returned if a reference cycle is detected. A list of the reference paths in the cycle, together with their locations, is returned.

Trait Implementations§

Source§

impl Debug for ConfigError

Source§

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

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

impl PartialEq for ConfigError

Source§

fn eq(&self, other: &ConfigError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ConfigError

Auto Trait Implementations§

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.