Struct linkify::LinkFinder
source · [−]pub struct LinkFinder { /* private fields */ }
Expand description
A configured link finder.
Implementations
sourceimpl LinkFinder
impl LinkFinder
sourcepub fn new() -> LinkFinder
pub fn new() -> LinkFinder
Create a new link finder with the default options for finding all kinds of links.
If you only want to find a certain kind of links, use the kinds
method.
sourcepub fn email_domain_must_have_dot(&mut self, value: bool) -> &mut LinkFinder
pub fn email_domain_must_have_dot(&mut self, value: bool) -> &mut LinkFinder
Require the domain parts of email addresses to have at least one dot.
Use false
to also find addresses such as root@localhost
.
sourcepub fn url_must_have_scheme(
&mut self,
url_must_have_scheme: bool
) -> &mut LinkFinder
pub fn url_must_have_scheme(
&mut self,
url_must_have_scheme: bool
) -> &mut LinkFinder
Set whether URLs must have a scheme, defaults to true
.
By default only URLs having a scheme defined are found.
By setting this to false
you make the scheme of URLs optional, to also find URLs like
example.org
. For some URLs the used scheme is important, and making the scheme optional
may lead to finding a lot of false positive URLs.
sourcepub fn kinds(&mut self, kinds: &[LinkKind]) -> &mut LinkFinder
pub fn kinds(&mut self, kinds: &[LinkKind]) -> &mut LinkFinder
Restrict the kinds of links that should be found to the specified ones.
sourcepub fn links<'t>(&self, text: &'t str) -> Links<'t>ⓘNotable traits for Links<'t>impl<'t> Iterator for Links<'t> type Item = Link<'t>;
pub fn links<'t>(&self, text: &'t str) -> Links<'t>ⓘNotable traits for Links<'t>impl<'t> Iterator for Links<'t> type Item = Link<'t>;
Find links in the specified input text.
Returns an Iterator
which only scans when next
is called (lazy).
sourcepub fn spans<'t>(&self, text: &'t str) -> Spans<'t>ⓘNotable traits for Spans<'t>impl<'t> Iterator for Spans<'t> type Item = Span<'t>;
pub fn spans<'t>(&self, text: &'t str) -> Spans<'t>ⓘNotable traits for Spans<'t>impl<'t> Iterator for Spans<'t> type Item = Span<'t>;
Iterate over spans in the specified input text.
A span represents a substring of the input text, which can either be a link, or plain text.
Returns an Iterator
which only scans when next
is called (lazy).
The spans that are returned by the Iterator
are consecutive,
and when combined represent the input text in its entirety.
Trait Implementations
sourceimpl Debug for LinkFinder
impl Debug for LinkFinder
Auto Trait Implementations
impl RefUnwindSafe for LinkFinder
impl Send for LinkFinder
impl Sync for LinkFinder
impl Unpin for LinkFinder
impl UnwindSafe for LinkFinder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more