Trait fractal::utils::string::PangoStrMutExt

source ·
pub trait PangoStrMutExt {
    // Required methods
    fn append_link_opening_tag(&mut self, uri: impl AsRef<str>);
    fn maybe_append_emote_name(&mut self, name: &mut Option<&str>);
    fn maybe_append_mention(
        &mut self,
        uri: impl TryInto<MatrixIdUri>,
        room: &Room,
    ) -> Option<Pill>;
    fn append_and_replace_at_room(
        &mut self,
        s: &str,
        room: &Room,
    ) -> Option<Pill>;
}
Expand description

Common extensions for adding Pango markup to mutable strings.

Required Methods§

Append the opening Pango markup link tag of the given URI parts.

The URI is also used as a title, so users can preview the link on hover.

source

fn maybe_append_emote_name(&mut self, name: &mut Option<&str>)

Append the given emote’s sender name and consumes it, if it is set.

source

fn maybe_append_mention( &mut self, uri: impl TryInto<MatrixIdUri>, room: &Room, ) -> Option<Pill>

Append the given URI as a mention, if it is one.

Returns the created Pill, it the URI was added as a mention.

source

fn append_and_replace_at_room(&mut self, s: &str, room: &Room) -> Option<Pill>

Append the given string and replace @room with a mention.

Returns the created Pill, it @room was found.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PangoStrMutExt for String

source§

fn maybe_append_emote_name(&mut self, name: &mut Option<&str>)

source§

fn maybe_append_mention( &mut self, uri: impl TryInto<MatrixIdUri>, room: &Room, ) -> Option<Pill>

source§

fn append_and_replace_at_room(&mut self, s: &str, room: &Room) -> Option<Pill>

Implementors§