Skip to main content

DxError

Enum DxError 

Source
pub enum DxError {
Show 25 variants UnexpectedEof(usize), ParseError { location: SourceLocation, message: String, snippet: String, }, InvalidSyntax { pos: usize, msg: String, }, SchemaError(String), TypeMismatch { expected: String, actual: String, }, UnknownAlias(String), UnknownAnchor(String), InvalidTypeHint(String), InvalidNumber(String), Utf8Error { offset: usize, }, Base62Error { char: char, position: usize, message: String, }, IntegerOverflow, InvalidMagic(u8, u8), UnsupportedVersion { found: u8, expected: u8, }, BufferTooSmall { required: usize, available: usize, }, CompressionError(String), DecompressionError(String), Io(String), UnsupportedPlatform(String), ConversionError(String), DittoNoPrevious(usize), PrefixError(String), InputTooLarge { size: usize, max: usize, }, RecursionLimitExceeded { depth: usize, max: usize, }, TableTooLarge { rows: usize, max: usize, },
}
Expand description

Comprehensive error type for all DX serializer operations

Variants§

§

UnexpectedEof(usize)

Unexpected end of input during parsing

§

ParseError

Parse error with location information and snippet

Fields

§location: SourceLocation

Source location where parsing failed.

§message: String

Human-readable parse failure message.

§snippet: String

Snippet of the problematic input (up to 50 chars)

§

InvalidSyntax

Invalid syntax at a specific position

Fields

§pos: usize

Byte position where the syntax error was detected.

§msg: String

Human-readable syntax failure message.

§

SchemaError(String)

Schema validation error

§

TypeMismatch

Type mismatch during parsing or conversion

Fields

§expected: String

Expected type or schema name.

§actual: String

Actual type or value kind that was found.

§

UnknownAlias(String)

Unknown alias reference

§

UnknownAnchor(String)

Unknown anchor reference

§

InvalidTypeHint(String)

Invalid type hint in schema

§

InvalidNumber(String)

Invalid number format

§

Utf8Error

Invalid UTF-8 sequence

Fields

§offset: usize

Byte offset where invalid UTF-8 begins.

§

Base62Error

Invalid Base62 character

Fields

§char: char

Invalid Base62 character.

§position: usize

Character position where the error was found.

§message: String

Human-readable Base62 failure message.

§

IntegerOverflow

Integer overflow during encoding/decoding

§

InvalidMagic(u8, u8)

Invalid magic bytes in binary header

§

UnsupportedVersion

Unsupported binary format version

Fields

§found: u8

Version found in the input.

§expected: u8

Version supported by this crate.

§

BufferTooSmall

Buffer too small for operation

Fields

§required: usize

Required number of bytes.

§available: usize

Available number of bytes.

§

CompressionError(String)

Compression operation failed

§

DecompressionError(String)

Decompression operation failed

§

Io(String)

General I/O error (wraps std::io::Error message)

§

UnsupportedPlatform(String)

Platform not supported for operation

§

ConversionError(String)

Format conversion error

§

DittoNoPrevious(usize)

Ditto operator without previous value

§

PrefixError(String)

Prefix inheritance failed

§

InputTooLarge

Input size exceeds maximum allowed

Fields

§size: usize

Input size in bytes.

§max: usize

Maximum allowed input size in bytes.

§

RecursionLimitExceeded

Recursion depth exceeds maximum allowed

Fields

§depth: usize

Observed recursion depth.

§max: usize

Maximum allowed recursion depth.

§

TableTooLarge

Table row count exceeds maximum allowed

Fields

§rows: usize

Observed table row count.

§max: usize

Maximum allowed table row count.

Implementations§

Source§

impl DxError

Source

pub fn parse_error( input: &[u8], offset: usize, message: impl Into<String>, ) -> Self

Create a parse error with location information and snippet

Source

pub fn parse_error_with_location( location: SourceLocation, message: impl Into<String>, snippet: impl Into<String>, ) -> Self

Create a parse error with explicit location and snippet

Source

pub fn type_mismatch( expected: impl Into<String>, actual: impl Into<String>, ) -> Self

Create a type mismatch error

Source

pub fn utf8_error(offset: usize) -> Self

Create a UTF-8 error at a specific offset

Source

pub fn base62_error( char: char, position: usize, message: impl Into<String>, ) -> Self

Create a Base62 error with position

Source

pub fn invalid_magic(byte0: u8, byte1: u8) -> Self

Create an invalid magic error

Source

pub fn unsupported_version(found: u8) -> Self

Create an unsupported version error

Source

pub fn buffer_too_small(required: usize, available: usize) -> Self

Create a buffer too small error

Source

pub fn input_too_large(size: usize) -> Self

Create an input too large error

Source

pub fn recursion_limit_exceeded(depth: usize) -> Self

Create a recursion limit exceeded error

Source

pub fn table_too_large(rows: usize) -> Self

Create a table too large error

Source

pub fn offset(&self) -> Option<usize>

Get the byte offset if available

Source

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

Get the source location if available

Source

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

Get the snippet if available

Source

pub fn line(&self) -> Option<usize>

Get line number if available (1-indexed)

Source

pub fn column(&self) -> Option<usize>

Get column number if available (1-indexed)

Source

pub fn is_recoverable(&self) -> bool

Check if this is a recoverable error

Trait Implementations§

Source§

impl Clone for DxError

Source§

fn clone(&self) -> DxError

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DxError

Source§

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

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

impl Display for DxError

Source§

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

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

impl Error for DxError

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<ConvertError> for DxError

Source§

fn from(err: ConvertError) -> Self

Convert a ConvertError into a DxError.

This conversion handles all ConvertError variants:

  • LlmParse: Converts the underlying ParseError to DxError
  • HumanParse: Converts to ConversionError with the error message
  • MachineFormat: Converts to ConversionError with the error message
Source§

impl From<Error> for DxError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for DxError

Source§

fn from(err: FromUtf8Error) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for DxError

Source§

fn from(err: ParseError) -> Self

Convert a ParseError from the LLM parser into a DxError.

This conversion preserves position information where available, mapping each ParseError variant to the most appropriate DxError variant.

Source§

impl From<Utf8Error> for DxError

Source§

fn from(err: Utf8Error) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DxError

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 DxError

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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.