Skip to main content

Pattern

Enum Pattern 

Source
pub enum Pattern<N: Node> {
    Predicate(Transform<N>),
    Selection(Path),
    Error(Error),
}
Expand description

An XPath pattern. A pattern most frequently appears as the value of a match attribute. A pattern is either a predicate pattern or a selection pattern.

A predicate pattern matches the current item if all of the predicates evaluate to true.

A selection pattern is subset of XPath path expressions.

Variants§

§

Predicate(Transform<N>)

§

Selection(Path)

§

Error(Error)

Implementations§

Source§

impl<N: Node> Pattern<N>

Source

pub fn is_err(&self) -> bool

Returns whether the Pattern is of type error.

Source

pub fn get_err(&self) -> Option<Error>

Source

pub fn matches<F: FnMut(&str) -> Result<(), Error>, G: FnMut(&str) -> Result<N, Error>, H: FnMut(&Url) -> Result<String, Error>>( &self, ctxt: &Context<N>, stctxt: &mut StaticContext<N, F, G, H>, i: &Item<N>, ) -> bool

Returns whether the given item matches the pattern. TODO: return dynamic errors

Source

pub fn terminal_node_test(&self) -> (Axis, Axis, NodeTest)

Find the NodeTest for the terminal step

Trait Implementations§

Source§

impl<N: Clone + Node> Clone for Pattern<N>

Source§

fn clone(&self) -> Pattern<N>

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<N: Node> Debug for Pattern<N>

Source§

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

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

impl<N: Node> TryFrom<&str> for Pattern<N>

Compile an XPath pattern.

Source§

type Error = Error

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

fn try_from(e: &str) -> Result<Self, <Pattern<N> as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl<N: Node> TryFrom<(&str, N)> for Pattern<N>

Compile an XPath pattern. Uses the supplied Node to resolve in-scope XML Namespaces.

Source§

type Error = Error

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

fn try_from(e: (&str, N)) -> Result<Self, <Pattern<N> as TryFrom<&str>>::Error>

Performs the conversion.
Source§

impl<'a, N: Node> TryFrom<(String, N)> for Pattern<N>

Source§

type Error = Error

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

fn try_from( e: (String, N), ) -> Result<Self, <Pattern<N> as TryFrom<(&'a str, N)>>::Error>

Performs the conversion.
Source§

impl<'a, N: Node> TryFrom<String> for Pattern<N>

Source§

type Error = Error

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

fn try_from(e: String) -> Result<Self, <Pattern<N> as TryFrom<&'a str>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<N> !Send for Pattern<N>

§

impl<N> !Sync for Pattern<N>

§

impl<N> Freeze for Pattern<N>
where N: Freeze,

§

impl<N> RefUnwindSafe for Pattern<N>
where N: RefUnwindSafe,

§

impl<N> Unpin for Pattern<N>
where N: Unpin,

§

impl<N> UnsafeUnpin for Pattern<N>
where N: UnsafeUnpin,

§

impl<N> UnwindSafe for Pattern<N>
where N: UnwindSafe,

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