From 58587f4e3074998056954de94af565a1684ba853 Mon Sep 17 00:00:00 2001 From: Ross MacArthur Date: Tue, 29 Mar 2022 09:17:08 +0200 Subject: [PATCH] Remove `search()` --- src/lib.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ebc7268..bcc4f68 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -340,27 +340,6 @@ pub fn iter() -> impl Iterator { .filter(|emoji| matches!(emoji.skin_tone(), Some(SkinTone::Default) | None)) } -/// Find an emoji by Unicode value or shortcode. -/// -/// # Examples -/// -/// ``` -/// let rocket = emojis::search("🚀").unwrap(); -/// assert_eq!(rocket.shortcode().unwrap(), "rocket"); -/// -/// let rocket = emojis::search("rocket").unwrap(); -/// assert_eq!(rocket, "🚀"); -/// ``` -pub fn search(query: &str) -> Option<&'static Emoji> { - crate::generated::EMOJIS.iter().find(|&e| { - e == query - || e.variations.contains(&query) - || e.aliases - .map(|aliases| aliases.contains(&query)) - .unwrap_or(false) - }) -} - /// Find an emoji by Unicode value. /// /// # Examples