pub struct Linkifier<'a> {
inner: &'a mut String,
mentions: MentionsMode<'a>,
}
Expand description
A helper type to linkify text.
Fields§
§inner: &'a mut String
The string containing the result.
mentions: MentionsMode<'a>
The mentions detection setting and results.
Implementations§
source§impl<'a> Linkifier<'a>
impl<'a> Linkifier<'a>
sourcepub fn new(inner: &'a mut String) -> Self
pub fn new(inner: &'a mut String) -> Self
Construct a new linkifier that will add text in the given string.
sourcepub fn detect_mentions(
self,
room: &'a Room,
pills: &'a mut Vec<Pill>,
detect_at_room: bool,
) -> Self
pub fn detect_mentions( self, room: &'a Room, pills: &'a mut Vec<Pill>, detect_at_room: bool, ) -> Self
Enable mentions detection in the given room and add pills to the given list.
If detect_at_room
is true
, it will also try to detect @room
mentions.
sourcepub fn linkify(self, text: &str)
pub fn linkify(self, text: &str)
Search and replace links in the given text.
Returns the list of mentions, if any where found.
sourcefn append_string(&mut self, s: &str)
fn append_string(&mut self, s: &str)
Append the given string.
Escapes the markup of the string.
sourcefn append_uri(&mut self, uri: &str, content: &str)
fn append_uri(&mut self, uri: &str, content: &str)
Append the given URI with the given link content.
Auto Trait Implementations§
impl<'a> Freeze for Linkifier<'a>
impl<'a> !RefUnwindSafe for Linkifier<'a>
impl<'a> !Send for Linkifier<'a>
impl<'a> !Sync for Linkifier<'a>
impl<'a> Unpin for Linkifier<'a>
impl<'a> !UnwindSafe for Linkifier<'a>
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more