pub trait Extract<'a> {
type T;
type Mention;
Show 18 methods
// Required methods
fn get_extract_url_without_protocol(&self) -> bool;
fn set_extract_url_without_protocol(
&mut self,
extract_url_without_protocol: bool,
);
fn extract(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T;
fn create_result(
&self,
s: &'a str,
entity_count: usize,
pairs: &mut Vec<UnprocessedEntity<'a>>,
) -> Self::T;
fn extract_reply_username(&self, s: &'a str) -> Self::Mention;
fn mention_result(
&self,
s: &'a str,
pairs: Option<Pair<'a, Rule>>,
) -> Self::Mention;
fn empty_result(&self) -> Self::T;
// Provided methods
fn extract_impl(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T { ... }
fn extract_urls_with_indices(&self, s: &'a str) -> Self::T { ... }
fn extract_hashtags(&self, s: &'a str) -> Self::T { ... }
fn extract_cashtags(&self, s: &'a str) -> Self::T { ... }
fn extract_mentioned_screennames(&self, s: &'a str) -> Self::T { ... }
fn extract_mentioned_screennames_with_indices(&self, s: &'a str) -> Self::T { ... }
fn extract_mentions_or_lists_with_indices(&self, s: &'a str) -> Self::T { ... }
fn extract_reply_username_impl(&self, s: &'a str) -> Self::Mention { ... }
fn extract_entities_with_indices(&self, s: &'a str) -> Self::T { ... }
fn extract_scan(&self, s: &'a str) -> Self::T { ... }
fn entity_from_pair(
&self,
ue: UnprocessedEntity<'a>,
start: i32,
end: i32,
) -> Option<Entity<'a>> { ... }
}Expand description
A common Trait implemented by the two Extractors, Extractor and ValidatingExtractor.
Required Associated Types§
Required Methods§
Sourcefn get_extract_url_without_protocol(&self) -> bool
fn get_extract_url_without_protocol(&self) -> bool
Get whether the extractor will detect URLs without schemes, such as “example.com”.
Sourcefn set_extract_url_without_protocol(
&mut self,
extract_url_without_protocol: bool,
)
fn set_extract_url_without_protocol( &mut self, extract_url_without_protocol: bool, )
Set whether the extractor will detect URLs without schemes, such as “example.com”.
Sourcefn extract(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T
fn extract(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T
Extract entities from the source text that match rules allowed by r_match.
Sourcefn create_result(
&self,
s: &'a str,
entity_count: usize,
pairs: &mut Vec<UnprocessedEntity<'a>>,
) -> Self::T
fn create_result( &self, s: &'a str, entity_count: usize, pairs: &mut Vec<UnprocessedEntity<'a>>, ) -> Self::T
Create the result type. The concrete type varies by implementation.
Sourcefn extract_reply_username(&self, s: &'a str) -> Self::Mention
fn extract_reply_username(&self, s: &'a str) -> Self::Mention
Create the mention result type. The concrete type varies by implementation.
Sourcefn mention_result(
&self,
s: &'a str,
pairs: Option<Pair<'a, Rule>>,
) -> Self::Mention
fn mention_result( &self, s: &'a str, pairs: Option<Pair<'a, Rule>>, ) -> Self::Mention
Create a mention result type from a pest::Pair.
Sourcefn empty_result(&self) -> Self::T
fn empty_result(&self) -> Self::T
Returns an empty result. Used when the input is invalid.
Provided Methods§
fn extract_impl(&self, s: &'a str, r_match: fn(Rule) -> bool) -> Self::T
Sourcefn extract_urls_with_indices(&self, s: &'a str) -> Self::T
fn extract_urls_with_indices(&self, s: &'a str) -> Self::T
Extract all URLs from the text, subject to value returned by Extract::get_extract_url_without_protocol.
Extract all Hashtags from the text
Extract all Cashtags from the text
Sourcefn extract_mentioned_screennames(&self, s: &'a str) -> Self::T
fn extract_mentioned_screennames(&self, s: &'a str) -> Self::T
Extract all usernames from the text. The same as Extract::extract_mentioned_screennames_with_indices, but included for compatibility.
Sourcefn extract_mentioned_screennames_with_indices(&self, s: &'a str) -> Self::T
fn extract_mentioned_screennames_with_indices(&self, s: &'a str) -> Self::T
Extract all usernames from the text.
Sourcefn extract_mentions_or_lists_with_indices(&self, s: &'a str) -> Self::T
fn extract_mentions_or_lists_with_indices(&self, s: &'a str) -> Self::T
Extract all usernames and lists from the text.
Sourcefn extract_reply_username_impl(&self, s: &'a str) -> Self::Mention
fn extract_reply_username_impl(&self, s: &'a str) -> Self::Mention
Extract a “reply”–a username that appears at the beginning of a tweet.
Sourcefn extract_entities_with_indices(&self, s: &'a str) -> Self::T
fn extract_entities_with_indices(&self, s: &'a str) -> Self::T
Extract all entities from the text (Usernames, Lists, Hashtags, Cashtags, and URLs).
Sourcefn extract_scan(&self, s: &'a str) -> Self::T
fn extract_scan(&self, s: &'a str) -> Self::T
Parse the text without extracting any entities.