pub(crate) struct Linkifier<'a> {
inner: &'a mut String,
mentions: MentionsMode<'a>,
}Expand description
A helper type to linkify text.
Fields§
§inner: &'a mut StringThe string containing the result.
mentions: MentionsMode<'a>The mentions detection setting and results.
Implementations§
Source§impl<'a> Linkifier<'a>
impl<'a> Linkifier<'a>
Sourcepub(crate) fn new(inner: &'a mut String) -> Self
pub(crate) fn new(inner: &'a mut String) -> Self
Construct a new linkifier that will add text in the given string.
Sourcepub(crate) fn detect_mentions(
self,
room: &'a Room,
pills: &'a mut Vec<Pill>,
detect_at_room: bool,
) -> Self
pub(crate) 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(crate) fn linkify(self, text: &str)
pub(crate) 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> UnsafeUnpin 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