ValidationError

Enum ValidationError 

Source
#[non_exhaustive]
pub enum ValidationError {
Show 16 variants EmptyDocument, EmptySection { section_index: usize, }, EmptyParagraph { section_index: usize, paragraph_index: usize, }, EmptyTable { section_index: usize, paragraph_index: usize, run_index: usize, }, EmptyTableRow { section_index: usize, paragraph_index: usize, run_index: usize, row_index: usize, }, InvalidSpan { field: &'static str, value: u16, section_index: usize, paragraph_index: usize, run_index: usize, row_index: usize, cell_index: usize, }, EmptyTextBox { section_index: usize, paragraph_index: usize, run_index: usize, }, EmptyFootnote { section_index: usize, paragraph_index: usize, run_index: usize, }, EmptyEndnote { section_index: usize, paragraph_index: usize, run_index: usize, }, InvalidPolygon { section_index: usize, paragraph_index: usize, run_index: usize, vertex_count: usize, }, InvalidShapeDimension { section_index: usize, paragraph_index: usize, run_index: usize, shape_type: &'static str, }, EmptyChartData { section_index: usize, paragraph_index: usize, run_index: usize, }, EmptyEquation { section_index: usize, paragraph_index: usize, run_index: usize, }, EmptyCategoryLabels { section_index: usize, paragraph_index: usize, run_index: usize, }, MismatchedSeriesLengths { section_index: usize, paragraph_index: usize, run_index: usize, series_name: String, x_len: usize, y_len: usize, }, EmptyTableCell { section_index: usize, paragraph_index: usize, run_index: usize, row_index: usize, cell_index: usize, },
}
Expand description

Specific validation failures with precise location context.

Every variant carries enough information to pinpoint the exact location of the problem (section index, paragraph index, etc.).

Marked #[non_exhaustive] so future phases can add variants without a breaking change.

§Examples

use hwpforge_core::error::ValidationError;

let err = ValidationError::EmptySection { section_index: 2 };
assert!(err.to_string().contains("Section 2"));

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

EmptyDocument

The document contains zero sections.

§

EmptySection

A section contains zero paragraphs.

Fields

§section_index: usize

Zero-based index of the offending section.

§

EmptyParagraph

A paragraph contains zero runs.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index within the section.

§

EmptyTable

A table contains zero rows.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

EmptyTableRow

A table row contains zero cells.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§row_index: usize

Zero-based row index within the table.

§

InvalidSpan

A span value (col_span or row_span) is zero.

Fields

§field: &'static str

Which span field failed (“col_span” or “row_span”).

§value: u16

The invalid value.

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§row_index: usize

Zero-based row index.

§cell_index: usize

Zero-based cell index.

§

EmptyTextBox

A TextBox control contains zero paragraphs.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

EmptyFootnote

A Footnote control contains zero paragraphs.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

EmptyEndnote

An Endnote control contains zero paragraphs.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

InvalidPolygon

A Polygon control has fewer than 3 vertices.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§vertex_count: usize

Number of vertices found.

§

InvalidShapeDimension

A shape (Ellipse or Polygon) has zero width or height.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§shape_type: &'static str

Type of shape (“Ellipse” or “Polygon”).

§

EmptyChartData

A Chart control has no data series.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

EmptyEquation

An Equation control has an empty script.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

EmptyCategoryLabels

A Category chart has an empty categories list.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§

MismatchedSeriesLengths

An XY series has mismatched x/y value lengths.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§series_name: String

Name of the offending series.

§x_len: usize

Length of x_values.

§y_len: usize

Length of y_values.

§

EmptyTableCell

A table cell contains zero paragraphs.

Fields

§section_index: usize

Zero-based section index.

§paragraph_index: usize

Zero-based paragraph index.

§run_index: usize

Zero-based run index.

§row_index: usize

Zero-based row index.

§cell_index: usize

Zero-based cell index.

Implementations§

Source§

impl ValidationError

Source

pub fn code(&self) -> CoreErrorCode

Returns the numeric error code for this validation error.

Trait Implementations§

Source§

impl Clone for ValidationError

Source§

fn clone(&self) -> ValidationError

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 ValidationError

Source§

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

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

impl Display for ValidationError

Source§

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

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

impl Error for ValidationError

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<ValidationError> for CoreError

Source§

fn from(source: ValidationError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for ValidationError

Source§

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

Source§

impl StructuralPartialEq for ValidationError

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.