Struct mlscraper_rust::selectors::Selector
source · pub struct Selector {
pub string: String,
pub score: i32,
/* private fields */
}
Fields§
§string: String
§score: i32
Implementations§
source§impl Selector
impl Selector
sourcepub fn new_from_parts(parts: Vec<SelectorPart>) -> Self
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.
pub fn len(&self) -> usize
pub fn try_select_with_skip( &self, handle: NodeHandle, parser: &Parser<'_>, skip: usize ) -> Option<NodeHandle>
pub fn try_select_with_skip_path( &self, handle: NodeHandle, parser: &Parser<'_>, skip: usize, max_len: usize ) -> Vec<Option<NodeHandle>>
sourcepub fn try_select(
&self,
handle: NodeHandle,
parser: &Parser<'_>
) -> Option<NodeHandle>
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.
pub fn try_select_path( &self, handle: NodeHandle, parser: &Parser<'_>, max_len: usize ) -> Vec<Option<NodeHandle>>
Trait Implementations§
source§impl From<SelectorPart> for Selector
impl From<SelectorPart> for Selector
source§fn from(value: SelectorPart) -> Self
fn from(value: SelectorPart) -> Self
Converts to this type from the input type.
source§impl PartialEq<Selector> for Selector
impl PartialEq<Selector> for Selector
impl Eq for Selector
Auto Trait Implementations§
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnwindSafe for Selector
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