Skip to content

Commit

Permalink
Remove search()
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmacarthur committed Mar 29, 2022
1 parent 509ea67 commit 58587f4
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,27 +340,6 @@ pub fn iter() -> impl Iterator<Item = &'static Emoji> {
.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
Expand Down

0 comments on commit 58587f4

Please sign in to comment.