Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
Show 19 variants Literal(Literal), VarRef(QName), ContextItem, FunctionCall { name: QName, args: Vec<Expr>, }, Sequence(Vec<Expr>), Filter { base: Box<Expr>, predicates: Vec<Expr>, }, Path(PathExpr), Negate(Box<Expr>), Castable { operand: Box<Expr>, target: SingleType, }, InstanceOf { operand: Box<Expr>, target: SequenceType, }, Union(Box<Expr>, Box<Expr>), Arithmetic { op: ArithmeticOp, lhs: Box<Expr>, rhs: Box<Expr>, }, Range(Box<Expr>, Box<Expr>), Comparison { op: ComparisonOp, lhs: Box<Expr>, rhs: Box<Expr>, }, And(Box<Expr>, Box<Expr>), Or(Box<Expr>, Box<Expr>), If { condition: Box<Expr>, then: Box<Expr>, otherwise: Box<Expr>, }, For { bindings: Vec<Binding>, body: Box<Expr>, }, Quantified { quantifier: Quantifier, bindings: Vec<Binding>, satisfies: Box<Expr>, },
}
Expand description

An XPath expression (XPath 2.0 production [2] Expr and below).

Variants§

§

Literal(Literal)

A string or numeric literal ([42] Literal).

§

VarRef(QName)

$name ([44] VarRef). Unprefixed variable names are in no namespace.

§

ContextItem

. ([47] ContextItemExpr).

§

FunctionCall

name(args) ([48] FunctionCall). Unprefixed function names are in the FN_NAMESPACE; which function the name and arity designate is decided when the expression is compiled, not by the parser.

Fields

§name: QName

The function name.

§args: Vec<Expr>

The arguments, each an ExprSingle.

§

Sequence(Vec<Expr>)

The comma operator ([2] Expr) with two or more operands, or () ([46] ParenthesizedExpr with no content) with none. A single parenthesized expression is that expression itself.

§

Filter

A primary expression followed by one or more predicates ([38] FilterExpr).

Fields

§base: Box<Expr>

The filtered expression.

§predicates: Vec<Expr>

The predicates, applied left to right.

§

Path(PathExpr)

A path expression with at least one / or //, or a single axis step ([25] PathExpr). A single filter expression without slash is not a path.

§

Negate(Box<Expr>)

Unary minus ([20] UnaryExpr); --x is two nested negations.

§

Castable

operand castable as T? ([18] CastableExpr).

Fields

§operand: Box<Expr>

The tested expression.

§target: SingleType

The target type.

§

InstanceOf

operand instance of T ([16] InstanceofExpr).

Fields

§operand: Box<Expr>

The tested expression.

§target: SequenceType

The tested type.

§

Union(Box<Expr>, Box<Expr>)

lhs | rhs ([14] UnionExpr), left associative.

§

Arithmetic

+ - * div idiv mod ([12] AdditiveExpr, [13] MultiplicativeExpr), left associative.

Fields

§op: ArithmeticOp

The operator.

§lhs: Box<Expr>

Left operand.

§rhs: Box<Expr>

Right operand.

§

Range(Box<Expr>, Box<Expr>)

lhs to rhs ([11] RangeExpr), not associative.

§

Comparison

A general or value comparison ([10] ComparisonExpr), not associative.

Fields

§op: ComparisonOp

The operator.

§lhs: Box<Expr>

Left operand.

§rhs: Box<Expr>

Right operand.

§

And(Box<Expr>, Box<Expr>)

lhs and rhs ([9] AndExpr), left associative.

§

Or(Box<Expr>, Box<Expr>)

lhs or rhs ([8] OrExpr), left associative.

§

If

if (condition) then a else b ([7] IfExpr).

Fields

§condition: Box<Expr>

The condition (an Expr, so possibly a sequence).

§then: Box<Expr>

The then branch.

§otherwise: Box<Expr>

The else branch.

§

For

for $v in e, ... return body ([4] ForExpr).

Fields

§bindings: Vec<Binding>

The bindings, in order (one or more).

§body: Box<Expr>

The return expression.

§

Quantified

some|every $v in e, ... satisfies test ([6] QuantifiedExpr).

Fields

§quantifier: Quantifier

some or every.

§bindings: Vec<Binding>

The bindings, in order (one or more).

§satisfies: Box<Expr>

The satisfies expression.

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Self

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 Expr

Source§

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

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

impl Display for Expr

Source§

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

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

impl Eq for Expr

Source§

impl PartialEq for Expr

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Expr

Auto Trait Implementations§

§

impl Forget for Expr

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnsafeUnpin for Expr

§

impl UnwindSafe for Expr

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.