Struct ingredient::rich_text::RichParser
source · pub struct RichParser {
pub ingredient_names: Vec<String>,
pub ip: IngredientParser,
}
Expand description
Parse some rich text that has some parsable Measure scattered around in it. Useful for displaying text with fancy formatting. returns Rich
use ingredient::{unit::Measure, IngredientParser, rich_text::{RichParser, Chunk}};
assert_eq!(
(RichParser {
ingredient_names: vec![],
ip: IngredientParser::new(true),
}).parse("hello 1 cups foo bar").unwrap(),
vec![
Chunk::Text("hello ".to_string()),
Chunk::Measure(vec![Measure::parse_new("cups", 1.0)]),
Chunk::Text(" foo bar".to_string())
]
);
Fields§
§ingredient_names: Vec<String>
§ip: IngredientParser
Implementations§
Trait Implementations§
source§impl Clone for RichParser
impl Clone for RichParser
source§fn clone(&self) -> RichParser
fn clone(&self) -> RichParser
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RichParser
impl Debug for RichParser
source§impl Default for RichParser
impl Default for RichParser
source§fn default() -> RichParser
fn default() -> RichParser
Returns the “default value” for a type. Read more
source§impl PartialEq<RichParser> for RichParser
impl PartialEq<RichParser> for RichParser
source§fn eq(&self, other: &RichParser) -> bool
fn eq(&self, other: &RichParser) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.