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§
Implementations§
Source§impl<N: Node> Pattern<N>
impl<N: Node> Pattern<N>
pub fn get_err(&self) -> Option<Error>
Sourcepub 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
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
Sourcepub fn terminal_node_test(&self) -> (Axis, Axis, NodeTest)
pub fn terminal_node_test(&self) -> (Axis, Axis, NodeTest)
Find the NodeTest for the terminal step
Trait Implementations§
Source§impl<N: Node> TryFrom<(&str, N)> for Pattern<N>
Compile an XPath pattern. Uses the supplied Node to resolve in-scope XML Namespaces.
impl<N: Node> TryFrom<(&str, N)> for Pattern<N>
Compile an XPath pattern. Uses the supplied Node to resolve in-scope XML Namespaces.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more