Skip to main content

YamlError

Enum YamlError 

Source
pub enum YamlError {
Show 17 variants ParseError { message: String, context: Option<Box<ErrorContext>>, }, InvalidRootType { found: String, context: Option<Box<ErrorContext>>, }, NonStringKey { key_type: String, path: String, context: Option<Box<ErrorContext>>, }, InvalidNumber { value: String, context: Option<Box<ErrorContext>>, }, InvalidExpression { message: String, context: Option<Box<ErrorContext>>, }, InvalidReference { message: String, context: Option<Box<ErrorContext>>, }, NestedObjectInScalar { path: String, context: Option<Box<ErrorContext>>, }, InvalidTensorElement { path: String, expected: String, found: String, context: Option<Box<ErrorContext>>, }, ResourceLimitExceeded { limit_type: String, limit: usize, actual: usize, context: Option<Box<ErrorContext>>, }, MaxDepthExceeded { max_depth: usize, actual_depth: usize, path: String, context: Option<Box<ErrorContext>>, }, DocumentTooLarge { size: usize, max_size: usize, context: Option<Box<ErrorContext>>, }, ArrayTooLong { length: usize, max_length: usize, path: String, context: Option<Box<ErrorContext>>, }, Conversion { message: String, context: Option<Box<ErrorContext>>, }, ForwardReference { alias: String, line: usize, }, CircularReference { cycle_path: String, anchors: Vec<String>, locations: Vec<usize>, }, InvalidAnchorName { name: String, reason: String, }, AnchorRedefinition { name: String, old_line: usize, new_line: usize, },
}
Expand description

Errors that can occur during YAML to HEDL conversion.

Variants§

§

ParseError

YAML parsing failed

Fields

§message: String

Error message describing the parse failure.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

InvalidRootType

Root element must be a mapping/object

Fields

§found: String

The type that was found instead of mapping.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

NonStringKey

Non-string key encountered in mapping

Fields

§key_type: String

The type of the non-string key.

§path: String

Path to the problematic key.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

InvalidNumber

Invalid number format

Fields

§value: String

The invalid number string.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

InvalidExpression

Invalid expression syntax

Fields

§message: String

Error message describing the expression issue.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

InvalidReference

Invalid reference format

Fields

§message: String

Error message describing the reference issue.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

NestedObjectInScalar

Nested objects not allowed in scalar context

Fields

§path: String

Path where nesting was found.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

InvalidTensorElement

Invalid tensor element type

Fields

§path: String

Path to the invalid tensor element.

§expected: String

Expected element type.

§found: String

Type that was found.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

ResourceLimitExceeded

Resource limit exceeded

Fields

§limit_type: String

Type of limit that was exceeded.

§limit: usize

Maximum allowed value.

§actual: usize

Actual value that exceeded the limit.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

MaxDepthExceeded

Maximum nesting depth exceeded

Fields

§max_depth: usize

Maximum allowed nesting depth.

§actual_depth: usize

Actual nesting depth encountered.

§path: String

Path where excessive nesting was found.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

DocumentTooLarge

Document too large

Fields

§size: usize

Actual document size in bytes.

§max_size: usize

Maximum allowed document size in bytes.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

ArrayTooLong

Array too long

Fields

§length: usize

Actual array length.

§max_length: usize

Maximum allowed array length.

§path: String

Path to the oversized array.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

Conversion

Generic conversion error

Fields

§message: String

Error message describing the conversion failure.

§context: Option<Box<ErrorContext>>

Source location and code snippet context.

§

ForwardReference

Forward reference to undefined anchor

Fields

§alias: String

Name of the undefined alias.

§line: usize

Line number where the forward reference occurred.

§

CircularReference

Circular anchor reference detected

Fields

§cycle_path: String

Path describing the circular reference chain.

§anchors: Vec<String>

Anchor names involved in the cycle.

§locations: Vec<usize>

Line numbers where each anchor is defined.

§

InvalidAnchorName

Invalid anchor name

Fields

§name: String

The invalid anchor name.

§reason: String

Reason why the anchor name is invalid.

§

AnchorRedefinition

Anchor redefinition

Fields

§name: String

The redefined anchor name.

§old_line: usize

Line number of the original definition.

§new_line: usize

Line number of the redefinition.

Implementations§

Source§

impl YamlError

Source

pub fn location(&self) -> Option<&Location>

Returns the location of the error, if available.

Source

pub fn snippet(&self) -> Option<&str>

Returns the code snippet, if available.

Source

pub fn path(&self) -> Option<&str>

Returns the path where the error occurred, if applicable.

Source

pub fn suggestions(&self) -> Vec<String>

Returns helpful suggestions for fixing the error.

Trait Implementations§

Source§

impl Clone for YamlError

Source§

fn clone(&self) -> YamlError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for YamlError

Source§

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

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

impl Display for YamlError

Source§

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

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

impl Error for YamlError

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 From<&str> for YamlError

Source§

fn from(err: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for YamlError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<LexError> for YamlError

Source§

fn from(err: LexError) -> Self

Converts to this type from the input type.
Source§

impl From<String> for YamlError

Source§

fn from(err: String) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for YamlError

Source§

fn eq(&self, other: &YamlError) -> 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 YamlError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.