Skip to main content

XPathError

Enum XPathError 

Source
pub enum XPathError {
Show 42 variants XPST0003 { message: String, }, XPST0008 { qname: String, }, XPST0051 { type_name: String, }, XPST0017 { name: String, arity: usize, namespace: String, }, XPST0081 { prefix: String, }, XPDY0002 { message: String, }, XPDY0050, XPTY0004 { expected: String, found: String, }, XPTY0004Cast { target_type: String, }, XPTY0018, XPTY0019, XPTY0020, XQTY0030, XQST0076 { collation: String, }, FORG0001 { value: String, target_type: String, }, FORG0003, FORG0004, FORG0005, FORG0006Named { function: String, arg_type: String, }, FORG0006 { message: String, }, FORG0008, FOCH0001 { codepoint: String, }, FOCH0002 { collation: String, }, FOCH0003 { normalization_form: String, }, FOAR0001, FOAR0002, FOCA0002 { qname: String, }, FOCA0003 { message: String, }, FOCA0005, FODT0001, FODT0002, FODT0003 { value: String, }, FOTY0012, FONS0005, FORG0009 { uri: String, }, FORX0001 { flags: String, }, FORX0002 { pattern: String, }, FORX0003 { pattern: String, }, FORX0004 { replacement: String, }, BinaryOperatorNotDefined { operator: String, left_type: String, right_type: String, }, UnaryOperatorNotDefined { operator: String, arg_type: String, }, Internal(String),
}
Expand description

XPath-specific error type with W3C specification error codes.

Variants§

§

XPST0003

XPST0003: Syntax error in expression.

Fields

§message: String
§

XPST0008

XPST0008: QName is not defined (undefined variable or type).

Fields

§qname: String
§

XPST0051

XPST0051: Unknown atomic type in sequence type.

Fields

§type_name: String
§

XPST0017

XPST0017: Function not found.

Fields

§name: String
§arity: usize
§namespace: String
§

XPST0081

XPST0081: Prefix cannot be expanded to namespace URI.

Fields

§prefix: String
§

XPDY0002

XPDY0002: Context item is undefined (with message).

Fields

§message: String
§

XPDY0050

XPDY0050: More than one item where singleton expected.

§

XPTY0004

XPTY0004: Type mismatch.

Fields

§expected: String
§found: String
§

XPTY0004Cast

XPTY0004 variant: Only string literals can be cast to certain types.

Fields

§target_type: String
§

XPTY0018

XPTY0018: Path expression result contains both nodes and atomic values.

§

XPTY0019

XPTY0019: Step result must not be atomic value in path expression.

§

XPTY0020

XPTY0020: Context item in axis step is not a node.

§

XQTY0030

XQTY0030: Validate expression argument must be single document or element.

§

XQST0076

XQST0076: Invalid collation URI.

Fields

§collation: String
§

FORG0001

FORG0001: Invalid value for cast/constructor.

Fields

§value: String
§target_type: String
§

FORG0003

FORG0003: fn:zero-or-one called with sequence > 1 item.

§

FORG0004

FORG0004: fn:one-or-more called with empty sequence.

§

FORG0005

FORG0005: fn:exactly-one called with wrong cardinality.

§

FORG0006Named

FORG0006: Invalid argument type for function.

Fields

§function: String
§arg_type: String
§

FORG0006

FORG0006: General effective boolean value error.

Fields

§message: String
§

FORG0008

FORG0008: Both arguments to fn:dateTime have a timezone

§

FOCH0001

FOCH0001: Invalid codepoint.

Fields

§codepoint: String
§

FOCH0002

FOCH0002: Unsupported collation.

Fields

§collation: String
§

FOCH0003

FOCH0003: Unsupported normalization form.

Fields

§normalization_form: String
§

FOAR0001

FOAR0001: Division by zero.

§

FOAR0002

FOAR0002: Numeric overflow or underflow.

§

FOCA0002

FOCA0002: QName has null namespace but non-empty prefix.

Fields

§qname: String
§

FOCA0003

FOCA0003: Input value too large for integer.

Fields

§message: String
§

FOCA0005

FOCA0005: NaN supplied as float/double value.

§

FODT0001

FODT0001: Overflow/underflow in date/time operation.

§

FODT0002

FODT0002: Overflow/underflow in duration operation.

§

FODT0003

FODT0003: Invalid timezone value.

Fields

§value: String
§

FOTY0012

FOTY0012: Argument node does not have a typed value.

§

FONS0005

FONS0005: Base-uri not defined in static context.

§

FORG0009

FORG0009: Error in resolving a relative URI.

Fields

§

FORX0001

FORX0001: Invalid regular expression flags.

Fields

§flags: String
§

FORX0002

FORX0002: Invalid regular expression.

Fields

§pattern: String
§

FORX0003

FORX0003: Regular expression matches zero-length string.

Fields

§pattern: String
§

FORX0004

FORX0004: Invalid replacement string.

Fields

§replacement: String
§

BinaryOperatorNotDefined

Binary operator not defined for argument types.

Fields

§operator: String
§left_type: String
§right_type: String
§

UnaryOperatorNotDefined

Unary operator not defined for argument type.

Fields

§operator: String
§arg_type: String
§

Internal(String)

Internal error for unexpected failures.

Implementations§

Source§

impl XPathError

Source

pub fn internal(message: impl Into<String>) -> Self

Create a new internal XPath error.

Source

pub fn syntax_error(message: impl Into<String>) -> Self

Create XPST0003 syntax error.

Source

pub fn undefined_qname(qname: impl Into<String>) -> Self

Create XPST0008 undefined QName error.

Source

pub fn unknown_type(type_name: impl Into<String>) -> Self

Create XPST0051 unknown type error.

Source

pub fn function_not_found( name: impl Into<String>, arity: usize, namespace: impl Into<String>, ) -> Self

Create XPST0017 function not found error.

Source

pub fn undefined_prefix(prefix: impl Into<String>) -> Self

Create XPST0081 undefined prefix error.

Source

pub fn context_undefined() -> Self

Create XPDY0002 context undefined error.

Source

pub fn more_than_one_item() -> Self

Create XPDY0050 more than one item error.

Source

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

Create XPTY0004 type mismatch error.

Source

pub fn cast_requires_string_literal(target_type: impl Into<String>) -> Self

Create XPTY0004 cast-only-from-string error.

Source

pub fn context_not_a_node() -> Self

Create XPTY0020 context item not a node error.

Source

pub fn invalid_cast_value( value: impl Into<String>, target_type: impl Into<String>, ) -> Self

Create FORG0001 invalid cast value error.

Source

pub fn invalid_argument_type( function: impl Into<String>, arg_type: impl Into<String>, ) -> Self

Create FORG0006 invalid argument type error.

Source

pub fn not_implemented(message: impl Into<String>) -> Self

Create a not implemented error.

Source

pub fn wrong_number_of_arguments( function: &str, expected: usize, actual: usize, ) -> Self

Create XPST0017 wrong number of arguments error.

Source

pub fn binary_operator_not_defined( operator: impl Into<String>, left_type: impl Into<String>, right_type: impl Into<String>, ) -> Self

Create binary operator not defined error.

Source

pub fn unary_operator_not_defined( operator: impl Into<String>, arg_type: impl Into<String>, ) -> Self

Create unary operator not defined error.

Source

pub fn no_typed_value() -> Self

Create FOTY0012 no typed value error.

Source

pub fn base_uri_not_defined() -> Self

Create FONS0005 base-uri not defined error.

Source

pub fn uri_resolution_error(uri: impl Into<String>) -> Self

Create FORG0009 URI resolution error.

Source

pub fn invalid_regex_flags(flags: impl Into<String>) -> Self

Create FORX0001 invalid regex flags error.

Source

pub fn invalid_regex_pattern(pattern: impl Into<String>) -> Self

Create FORX0002 invalid regex pattern error.

Source

pub fn regex_matches_zero_length(pattern: impl Into<String>) -> Self

Create FORX0003 regex matches zero-length string error.

Source

pub fn invalid_replacement_string(replacement: impl Into<String>) -> Self

Create FORX0004 invalid replacement string error.

Source

pub fn unsupported_collation(collation: impl Into<String>) -> Self

Create XQST0076 unsupported collation error.

Source

pub fn unknown_collation(collation: impl Into<String>) -> Self

Create FOCH0002 unsupported collation error.

Source

pub fn error_code(&self) -> Option<&'static str>

Get the error code (e.g., “XPTY0004”) if this is a spec-defined error.

Trait Implementations§

Source§

impl Clone for XPathError

Source§

fn clone(&self) -> XPathError

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 XPathError

Source§

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

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

impl Display for XPathError

Source§

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

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

impl Error for XPathError

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<NavigatorError> for XPathError

Source§

fn from(e: NavigatorError) -> Self

Converts to this type from the input type.
Source§

impl From<ParseError> for XPathError

Source§

fn from(e: ParseError) -> Self

Converts to this type from the input type.

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> ErasedDestructor for T
where T: 'static,

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

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.