pub struct LinkSource {
pub selector: String,
pub attribute: String,
pub link_type: Option<LinkType>,
}Expand description
One selector/attribute pair used during link extraction.
This is useful when the default HTML link sources are not enough for the target site and you need to teach the extractor about custom attributes.
Fields§
§selector: StringCSS selector used to find candidate elements.
attribute: StringAttribute name that contains the URL.
link_type: Option<LinkType>Optional fixed link type for matches from this source.
Implementations§
Source§impl LinkSource
impl LinkSource
Sourcepub fn new(
selector: impl Into<String>,
attribute: impl Into<String>,
) -> LinkSource
pub fn new( selector: impl Into<String>, attribute: impl Into<String>, ) -> LinkSource
Creates a new source definition.
Sourcepub fn with_link_type(self, link_type: LinkType) -> LinkSource
pub fn with_link_type(self, link_type: LinkType) -> LinkSource
Overrides the inferred link type for this source.
Trait Implementations§
Source§impl Clone for LinkSource
impl Clone for LinkSource
Source§fn clone(&self) -> LinkSource
fn clone(&self) -> LinkSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinkSource
impl Debug for LinkSource
Source§impl PartialEq for LinkSource
impl PartialEq for LinkSource
impl Eq for LinkSource
impl StructuralPartialEq for LinkSource
Auto Trait Implementations§
impl Freeze for LinkSource
impl RefUnwindSafe for LinkSource
impl Send for LinkSource
impl Sync for LinkSource
impl Unpin for LinkSource
impl UnsafeUnpin for LinkSource
impl UnwindSafe for LinkSource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.