pub enum Selector<'a> {
Show 14 variants Tag(&'a [u8]), Id(&'a [u8]), Class(&'a [u8]), All, And(Box<Selector<'a>>, Box<Selector<'a>>), Or(Box<Selector<'a>>, Box<Selector<'a>>), Descendant(Box<Selector<'a>>, Box<Selector<'a>>), Parent(Box<Selector<'a>>, Box<Selector<'a>>), Attribute(&'a [u8]), AttributeValue(&'a [u8], &'a [u8]), AttributeValueWhitespacedContains(&'a [u8], &'a [u8]), AttributeValueStartsWith(&'a [u8], &'a [u8]), AttributeValueEndsWith(&'a [u8], &'a [u8]), AttributeValueSubstring(&'a [u8], &'a [u8]),
}
Expand description

A single query selector node

Variants§

§

Tag(&'a [u8])

Tag selector: foo

§

Id(&'a [u8])

ID selector: #foo

§

Class(&'a [u8])

Class selector: .foo

§

All

All selector: *

§

And(Box<Selector<'a>>, Box<Selector<'a>>)

And combinator: .foo.bar

§

Or(Box<Selector<'a>>, Box<Selector<'a>>)

Or combinator: .foo, .bar

§

Descendant(Box<Selector<'a>>, Box<Selector<'a>>)

Descendant combinator: .foo .bar

§

Parent(Box<Selector<'a>>, Box<Selector<'a>>)

Parent combinator: .foo > .bar

§

Attribute(&'a [u8])

Attribute: [foo]

§

AttributeValue(&'a [u8], &'a [u8])

Attribute with value: [foo=bar]

§

AttributeValueWhitespacedContains(&'a [u8], &'a [u8])

Attribute with whitespace-separated list of values that contains a value: [foo~=bar]

§

AttributeValueStartsWith(&'a [u8], &'a [u8])

Attribute with value that starts with: [foo^=bar]

§

AttributeValueEndsWith(&'a [u8], &'a [u8])

Attribute with value that ends with: [foo$=bar]

§

AttributeValueSubstring(&'a [u8], &'a [u8])

Attribute with value that contains: [foo*=bar]

Implementations§

source§

impl<'a> Selector<'a>

source

pub fn matches<'b>(&self, node: &Node<'b>) -> bool

Checks if the given node matches this selector

Trait Implementations§

source§

impl<'a> Clone for Selector<'a>

source§

fn clone(&self) -> Selector<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Selector<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Selector<'a>

§

impl<'a> Send for Selector<'a>

§

impl<'a> Sync for Selector<'a>

§

impl<'a> Unpin for Selector<'a>

§

impl<'a> UnwindSafe for Selector<'a>

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

§

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

§

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

§

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.