Struct Selector

Source
pub struct Selector {
    pub string: String,
    pub score: i32,
    /* private fields */
}

Fields§

§string: String§score: i32

Implementations§

Source§

impl Selector

Source

pub fn new_from_parts(parts: Vec<SelectorPart>) -> Self

Create a new selector from multiple SelectorParts. The parts are interspersed with “ > “; this means the element matched by each SelectorPart must be the direct parent of the element matched by the nexted SelectorPart.

Source

pub fn len(&self) -> usize

Source

pub fn try_select_with_skip( &self, handle: NodeHandle, parser: &Parser<'_>, skip: usize, ) -> Option<NodeHandle>

Source

pub fn try_select_with_skip_path( &self, handle: NodeHandle, parser: &Parser<'_>, skip: usize, max_len: usize, ) -> Vec<Option<NodeHandle>>

Source

pub fn try_select( &self, handle: NodeHandle, parser: &Parser<'_>, ) -> Option<NodeHandle>

Tries to find a node matching this Selector by searching all nodes below handle. A result will be returned iff exactly one element matched.

Source

pub fn try_select_path( &self, handle: NodeHandle, parser: &Parser<'_>, max_len: usize, ) -> Vec<Option<NodeHandle>>

Trait Implementations§

Source§

impl Clone for Selector

Source§

fn clone(&self) -> Selector

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 Debug for Selector

Source§

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

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

impl From<SelectorPart> for Selector

Source§

fn from(value: SelectorPart) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Selector

Source§

fn eq(&self, other: &Selector) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToString for Selector

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl TrieKey for Selector

Source§

fn encode_bytes(&self) -> Vec<u8>

Encode a value as a vector of bytes.
Source§

fn encode(&self) -> NibbleVec<[u8; 64]>

Encode a value as a NibbleVec.
Source§

impl Eq for Selector

Auto Trait Implementations§

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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V