[][src]Enum hayagriva::Selector

#[non_exhaustive]pub enum Selector {
    Wildcard,
    Entry(EntryType),
    Neg(Box<Self>),
    Binding(StringBox<Self>),
    Attr(Box<Self>, Vec<String>),
    Alt(Vec<Self>),
    Multi(Vec<Self>),
    Ancestrage(Box<Self>, Box<Self>),
}

A selector used to filter bibliographies and match on entries.

Variants (Non-exhaustive)

Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Wildcard

A wildcard selector: *.

Entry(EntryType)

An entry type literal: report.

Neg(Box<Self>)

A negation: !x.

Binding(StringBox<Self>)

A binding: x:misc.

Attr(Box<Self>, Vec<String>)

An attribute filtering: abc[att1, attr2].

Alt(Vec<Self>)

An alternate selector: a | b.

Multi(Vec<Self>)

A multi-parent selector: a & b.

Ancestrage(Box<Self>, Box<Self>)

An ancestrage selector: a > b.

Implementations

impl Selector[src]

pub fn parse(src: &str) -> Result<Self, SelectorError>[src]

Parse a selector from a string.

pub fn matches(&self, entry: &Entry) -> bool[src]

Checks if the selector matches the provided Entry.

pub fn apply<'s>(&self, entry: &'s Entry) -> Option<HashMap<String, &'s Entry>>[src]

Applies the selector to an Entry and returns the bound variables in a hash map if there was a match.

Trait Implementations

impl Clone for Selector[src]

impl Debug for Selector[src]

impl Eq for Selector[src]

impl PartialEq<Selector> for Selector[src]

impl StructuralEq for Selector[src]

impl StructuralPartialEq for Selector[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.