pub struct Etymology {
pub word: String,
pub label: String,
pub etymology: String,
}
Expand description
An etymology as retrieved from EtymOnline.com.
Fields§
§word: String
The search term used for looking up an entry.
label: String
Container for the word, along with its part of speech, from the entry.
etymology: String
The entry as retrieved from EtymOnline.com. Currently this content is formatted for terminal output, including bold and italics.
Implementations§
source§impl Etymology
impl Etymology
sourcepub fn new(word: &str) -> Result<Self>
pub fn new(word: &str) -> Result<Self>
Performs a lookup via EtymOnline.com for the given word. Fallible, as it can fail via network error, or simply not find an entry. Error types are non-specific for simplicity’s sake.
sourcepub fn beautify(etym_html: &str) -> Result<String>
pub fn beautify(etym_html: &str) -> Result<String>
Substitute HTML formatting for italics with terminal escape codes. Does NOT intelligently determine whether terminal is interactive.
sourcepub fn extract_etymology_html(raw_html: &str) -> Result<String>
pub fn extract_etymology_html(raw_html: &str) -> Result<String>
From raw HTML results of query, excise just the first definition found.
sourcepub fn extract_word_name(raw_html: &str) -> Result<String>
pub fn extract_word_name(raw_html: &str) -> Result<String>
Extract the entry name, e.g. Viking (n.)