gitui 0.28.1

blazing fast terminal-ui for git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use once_cell::sync::Lazy;
use std::borrow::Cow;

static EMOJI_REPLACER: Lazy<gh_emoji::Replacer> =
	Lazy::new(gh_emoji::Replacer::new);

// Replace markdown emojis with Unicode equivalent
// :hammer: --> 🔨
#[inline]
pub fn emojifi_string(s: String) -> String {
	if let Cow::Owned(altered_s) = EMOJI_REPLACER.replace_all(&s) {
		altered_s
	} else {
		s
	}
}