Skip to main content

Selector

Enum Selector 

Source
pub enum Selector<'a, const MAX_SELECTOR_NODES: usize = 0> {
    Tag(&'a [u8]),
    Id(&'a [u8]),
    Class(&'a [u8]),
    All,
    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: *

§

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, const MAX_SELECTOR_NODES: usize> Selector<'a, MAX_SELECTOR_NODES>

Source

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

Checks if the given node matches this selector

Trait Implementations§

Source§

impl<'a, const MAX_SELECTOR_NODES: usize> Clone for Selector<'a, MAX_SELECTOR_NODES>

Source§

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

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<'a, const MAX_SELECTOR_NODES: usize> Debug for Selector<'a, MAX_SELECTOR_NODES>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, const MAX_SELECTOR_NODES: usize> Freeze for Selector<'a, MAX_SELECTOR_NODES>

§

impl<'a, const MAX_SELECTOR_NODES: usize> RefUnwindSafe for Selector<'a, MAX_SELECTOR_NODES>

§

impl<'a, const MAX_SELECTOR_NODES: usize> Send for Selector<'a, MAX_SELECTOR_NODES>

§

impl<'a, const MAX_SELECTOR_NODES: usize> Sync for Selector<'a, MAX_SELECTOR_NODES>

§

impl<'a, const MAX_SELECTOR_NODES: usize> Unpin for Selector<'a, MAX_SELECTOR_NODES>

§

impl<'a, const MAX_SELECTOR_NODES: usize> UnsafeUnpin for Selector<'a, MAX_SELECTOR_NODES>

§

impl<'a, const MAX_SELECTOR_NODES: usize> UnwindSafe for Selector<'a, MAX_SELECTOR_NODES>

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