Skip to main content

ParseErrorKind

Enum ParseErrorKind 

Source
pub enum ParseErrorKind {
Show 55 variants Other(String), UnknownExpression(String), WrongArgCount { op: String, expected: String, found: usize, }, TypeMismatch { expected: String, found: String, }, NotComparable { op: String, ty: String, }, CannotCompare { lhs: String, rhs: String, }, NotInterpolatable(String), UnboundVariable(String), Zoom(&'static str), RequiresExactlyOneArg { op: String, found: usize, }, ExpectedOneArgument, ExpectedArgsOfType { sig: String, found: String, }, MatchAtLeast4 { found: usize, }, ArrayItemType, ArrayLength, BareObject, EmptyArray, ExpressionNameNotString { found: &'static str, }, GlobalStateProperty { found: String, }, AscendingStops { kind: String, }, ExponentialBase, CubicBezier, CollatorOptions, NumberFormatExclusive, SliceFirstArg { found: String, }, SearchNeedle { found: String, }, BranchLabelsType, BranchLabelsUnique, BranchLabelsEmpty, BranchLabelNotInteger, BranchLabelTooLarge, GeojsonPolygon { op: String, }, LetBindingNameString, VarBindingName, NumberFormatOptionsObject, VerticalAlign { found: String, }, ExpectedEvenArgs { op: &'static str, }, ExpectedOddArgsCase, ExpectedOddArgsLet, FormatAtLeastOne, CollatorOneArg, NumberFormatTwoArgs, ExpectedNArgs { n: usize, found: usize, }, FormatFirstSection, ExtArgCount { kind: &'static str, op: String, expected: usize, found: usize, }, MacroDepth { op: String, }, InterpolationStopNumber, StepStopNumber, InterpolationTypeArray, InterpolationTypeName, UnknownInterpolationType { name: String, }, CollatorNonString, ExpectedStringOrArray { found: String, }, FormattedTextType, VariableName,
}
Expand description

The semantic cause of a parse/compile error.

Variants§

§

Other(String)

A wrapped runtime error surfaced by compile-time constant folding. (Every intrinsic parse error has a dedicated variant below.)

§

UnknownExpression(String)

An unrecognized operator name.

§

WrongArgCount

Wrong number of arguments to an operator (expected is a human range).

Fields

§expected: String
§found: usize
§

TypeMismatch

An expression’s type did not satisfy the expected type.

Fields

§expected: String
§found: String
§

NotComparable

A comparison operator applied to an unsupported operand type.

Fields

§

CannotCompare

A comparison between two incompatible concrete types.

Fields

§

NotInterpolatable(String)

An interpolate output whose type cannot be interpolated.

§

UnboundVariable(String)

An unbound var reference.

§

Zoom(&'static str)

Misuse of the zoom expression.

§

RequiresExactlyOneArg

An operator that takes exactly one argument (literal/within/…).

Fields

§found: usize
§

ExpectedOneArgument

A single-argument coercion (to-boolean/to-string) with wrong arity.

§

ExpectedArgsOfType

A CompoundExpression whose arity matched no typed overload.

Fields

§found: String
§

MatchAtLeast4

match with fewer than four arguments.

Fields

§found: usize
§

ArrayItemType

The first (item-type) argument of array was not a valid type name.

§

ArrayLength

The length argument of array was not a positive integer literal.

§

BareObject

A bare object used where an expression was expected.

§

EmptyArray

An empty array (no operator).

§

ExpressionNameNotString

The operator slot was not a string. found is the JS typeof.

Fields

§found: &'static str
§

GlobalStateProperty

The global-state property argument was not a string. found is a type.

Fields

§found: String
§

AscendingStops

step/interpolate stop inputs were not strictly ascending.

Fields

§kind: String
§

ExponentialBase

exponential interpolation without a numeric base.

§

CubicBezier

A malformed cubic-bezier interpolation type.

§

CollatorOptions

The collator options argument was not an object.

§

NumberFormatExclusive

number-format given both currency and unit.

§

SliceFirstArg

slice’s first argument was not an array or string.

Fields

§found: String
§

SearchNeedle

An in/index-of needle (checked statically) was not a primitive.

Fields

§found: String
§

BranchLabelsType

A match branch label was not a number or string.

§

BranchLabelsUnique

Duplicate match branch labels.

§

BranchLabelsEmpty

A match branch with no labels.

§

BranchLabelNotInteger

A non-integer numeric match branch label.

§

BranchLabelTooLarge

A numeric match branch label beyond the safe-integer range.

§

GeojsonPolygon

A within/distance argument was not valid polygon geojson.

Fields

§

LetBindingNameString

A let binding name was not a string.

§

VarBindingName

A var binding name was not a string.

§

NumberFormatOptionsObject

The number-format options argument was not an object.

§

VerticalAlign

A format vertical-align option had an invalid value.

Fields

§found: String
§

ExpectedEvenArgs

match/step/interpolate given an odd number of arguments.

Fields

§op: &'static str
§

ExpectedOddArgsCase

case given an even number of arguments.

§

ExpectedOddArgsLet

let given an even number of arguments.

§

FormatAtLeastOne

format given no sections.

§

CollatorOneArg

collator given other than one argument.

§

NumberFormatTwoArgs

number-format given other than two arguments.

§

ExpectedNArgs

An operator taking a fixed count other than one, with wrong arity.

Fields

§found: usize
§

FormatFirstSection

A format first argument that was a bare options object.

§

ExtArgCount

A user macro/function/native call with the wrong argument count.

Fields

§kind: &'static str
§expected: usize
§found: usize
§

MacroDepth

A macro expanded past the recursion-depth limit.

Fields

§

InterpolationStopNumber

An interpolate stop input was not a number literal.

§

StepStopNumber

A step stop input was not a number literal.

§

InterpolationTypeArray

An interpolation type was not an array (e.g. ["linear"]).

§

InterpolationTypeName

An interpolation type name was not a string.

§

UnknownInterpolationType

An unrecognized interpolation type.

Fields

§name: String
§

CollatorNonString

A collator compared non-string operands.

§

ExpectedStringOrArray

slice/concat argument was not a string or array.

Fields

§found: String
§

FormattedTextType

A format section’s text was not a valid formatted type.

§

VariableName

A let variable name contained invalid characters.

Trait Implementations§

Source§

impl Clone for ParseErrorKind

Source§

fn clone(&self) -> ParseErrorKind

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 ParseErrorKind

Source§

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

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

impl Display for ParseErrorKind

Source§

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

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

impl PartialEq for ParseErrorKind

Source§

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.