Function egg_mode_text::mention_entities
[−]
[src]
pub fn mention_entities(text: &str) -> Vec<Entity>
Parses the given string for user mentions.
This is given as a convenience function for uses where mentions are needed but list mentions are
not. This function effectively returns the same set as mention_list_entities
but with list
mentions removed.
Example
use egg_mode_text::{EntityKind, mention_entities}; let text = "sample text with a mention for @twitter and a link to @rustlang/fakelist"; let mut results = mention_entities(text).into_iter(); let entity = results.next().unwrap(); assert_eq!(entity.kind, EntityKind::ScreenName); assert_eq!(entity.substr(text), "@twitter"); assert_eq!(results.next(), None);