Error

Enum Error 

Source
pub enum Error<'i> {
Show 27 variants DecodeError { error: DecodeError, }, EncodeError { error: EncodeError, }, FileOpenError { path: PathBuf, io_error: Error, }, FileReadError { path: PathBuf, io_error: Error, }, FrameNumberNonUnique { frame_number: FrameNumber, frame_pairs: Vec<Pair<'i, Rule>>, }, DecodedDataInvalidUtf8(FromUtf8Error), ObjectDataExpected, ObjectDataSurplus { object_data: ObjectData, surplus_pairs: Pairs<'i, Rule>, }, PestError(Error<Rule>), ParseBdyKind { value_pair: Pair<'i, Rule>, error: BdyKindParseError, }, ParseCPointKind { value_pair: Pair<'i, Rule>, error: CPointKindParseError, }, ParseItrKind { value_pair: Pair<'i, Rule>, error: ItrKindParseError, }, ParseItrEffect { value_pair: Pair<'i, Rule>, error: EffectParseError, }, ParseOPointKind { value_pair: Pair<'i, Rule>, error: OPointKindParseError, }, ParseOPointAction { value_pair: Pair<'i, Rule>, error: ParseIntError, }, ParseWPointKind { value_pair: Pair<'i, Rule>, error: WPointKindParseError, }, ParseWeaponAct { value_pair: Pair<'i, Rule>, error: ParseIntError, }, ParseWeaponStrengthIndex { value_pair: Pair<'i, Rule>, error: ParseIntError, }, ParseFloat { field: &'static str, value_pair: Pair<'i, Rule>, error: ParseFloatError, }, ParseInt { field: &'static str, value_pair: Pair<'i, Rule>, error: ParseIntError, }, ParsePath { field: &'static str, value_pair: Pair<'i, Rule>, }, ElementBuildNone(Pair<'i, Rule>), GrammarSingle { rule_expected: Rule, pair_found: Option<Pair<'i, Rule>>, }, Grammar { rules_expected: &'static [Rule], pair_found: Option<Pair<'i, Rule>>, }, ValueExpected { tag_pair: Pair<'i, Rule>, }, StateParse { value_pair: Pair<'i, Rule>, error: StateParseError, }, Unreachable { error: Box<dyn Error>, },
}

Variants§

§

DecodeError

Error while decoding a data file.

Fields

§error: DecodeError

Underlying DecodeError.

§

EncodeError

Error while decoding a data file.

Fields

§error: EncodeError

Underlying EncodeError.

§

FileOpenError

Failed to open data file from the file system.

Fields

§path: PathBuf

Path that was attempted to be opened as a file.

§io_error: Error

The io::Error returned by the OS.

§

FileReadError

Failed to read data from a data file.

Fields

§path: PathBuf

Path to the file that was attempted to be read.

§io_error: Error

The io::Error returned by the OS.

§

FrameNumberNonUnique

Fields

§frame_number: FrameNumber

FrameNumber that is used across multiple frames.

§frame_pairs: Vec<Pair<'i, Rule>>

Parsed Pairs of the frames with non-unique frame numbers.

§

DecodedDataInvalidUtf8(FromUtf8Error)

Data file is not valid UTF8.

§

ObjectDataExpected

Expected to parse object data, but got nothing.

§

ObjectDataSurplus

ObjectData is successfully parsed, but there is surplus data.

Fields

§object_data: ObjectData

The successfully parsed ObjectData.

§surplus_pairs: Pairs<'i, Rule>

Additional pairs.

§

PestError(Error<Rule>)

Pest could not parse the input with the object grammar.

§

ParseBdyKind

A pair failed to parse as a BdyKind.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: BdyKindParseError

The BdyKindParseError from the parse attempt,

§

ParseCPointKind

A pair failed to parse as an CPointKind.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: CPointKindParseError

The CPointKindParseError from the parse attempt,

§

ParseItrKind

A pair failed to parse as an ItrKind.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: ItrKindParseError

The ItrKindParseError from the parse attempt,

§

ParseItrEffect

A pair failed to parse as an Effect.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: EffectParseError

The EffectParseError from the parse attempt,

§

ParseOPointKind

A pair failed to parse as an OPointKind.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: OPointKindParseError

The OPointKindParseError from the parse attempt,

§

ParseOPointAction

Failed to parse opoint: action: value as FrameNumberNext.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: ParseIntError

The OPointKindParseError from the parse attempt,

§

ParseWPointKind

A pair failed to parse as a WPointKind.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: WPointKindParseError

The WPointKindParseError from the parse attempt,

§

ParseWeaponAct

Failed to parse weaponact: value as FrameNumberNext.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: ParseIntError

The ParseIntError from the parse attempt,

§

ParseWeaponStrengthIndex

Failed to parse attacking: value as WeaponStrengthIndex.

Fields

§value_pair: Pair<'i, Rule>

The value that failed to be parsed.

§error: ParseIntError

The ParseIntError from the parse attempt,

§

ParseFloat

A pair failed to parse as a float.

Fields

§field: &'static str

Human readable name of the field.

§value_pair: Pair<'i, Rule>

The string that failed to be parsed into its value type.

§error: ParseFloatError

The ParseFloatError from the parse attempt,

§

ParseInt

A pair failed to parse as an integer.

Fields

§field: &'static str

Human readable name of the field.

§value_pair: Pair<'i, Rule>

The string that failed to be parsed into its value type.

§error: ParseIntError

The ParseIntError from the parse attempt,

§

ParsePath

A pair failed to parse as a Path.

Fields

§field: &'static str

Human readable name of the field.

§value_pair: Pair<'i, Rule>

The string that failed to be parsed into its value type.

§

ElementBuildNone(Pair<'i, Rule>)

Frame element was built but returned with None.

If this is reached, there is a bug in the Element object data parsing code.

§

GrammarSingle

Error should be unreachable based on the lf2_object.pest grammar.

If this variant is hit, then there is a bug in either the grammar, or pest.

Fields

§rule_expected: Rule

The data rule that is valid in this position.

§pair_found: Option<Pair<'i, Rule>>

The actual data rule.

§

Grammar

Error should be unreachable based on the lf2_object.pest grammar.

If this variant is hit, then there is a bug in either the grammar, or pest.

Fields

§rules_expected: &'static [Rule]

The data rules that are valid in this position.

§pair_found: Option<Pair<'i, Rule>>

The actual data rule.

§

ValueExpected

Expected a tag value, but got nothing.

Error should be unreachable based on the lf2_object.pest grammar.

If this variant is hit, then there is a bug in either the grammar, or pest.

Fields

§tag_pair: Pair<'i, Rule>

Pair of the preceeding rule.

§

StateParse

Errors when parsing a string as a State.

Fields

§value_pair: Pair<'i, Rule>

The string that failed to be parsed into the State.

§error: StateParseError

The underlying error.

§

Unreachable

Variant that should not be reachable, such as through an Infallible error type..

Fields

§error: Box<dyn Error>

This should really be unreachable, e.g. the Error type is Infallible during parsing.

Trait Implementations§

Source§

impl<'i> Debug for Error<'i>

Source§

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

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

impl<'i> Display for Error<'i>

Source§

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

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

impl<'i> Error for Error<'i>

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl<'e> From<DecodeError> for Error<'e>

Source§

fn from(error: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl<'e> From<EncodeError> for Error<'e>

Source§

fn from(error: EncodeError) -> Self

Converts to this type from the input type.
Source§

impl<'i> From<Error<Rule>> for Error<'i>

Source§

fn from(error: Error<Rule>) -> Self

Converts to this type from the input type.
Source§

impl<'e> From<FromUtf8Error> for Error<'e>

Source§

fn from(e: FromUtf8Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'i> Freeze for Error<'i>

§

impl<'i> !RefUnwindSafe for Error<'i>

§

impl<'i> !Send for Error<'i>

§

impl<'i> !Sync for Error<'i>

§

impl<'i> Unpin for Error<'i>

§

impl<'i> !UnwindSafe for Error<'i>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.