#[non_exhaustive]pub struct Xprs<'a> {
pub root: Element<'a>,
pub vars: HashSet<&'a str>,
}Expand description
Represents a mathematical expression and its variables.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.root: Element<'a>The root element of the expression.
vars: HashSet<&'a str>The set of variables present in the expression.
Implementations§
Source§impl Xprs<'_>
impl Xprs<'_>
Sourcepub fn eval(&self, variables: &HashMap<&str, f64>) -> Result<f64, EvalError>
pub fn eval(&self, variables: &HashMap<&str, f64>) -> Result<f64, EvalError>
Evaluates the expression using the provided variable values.
Returns an f64 if the evaluation is successful, or an EvalError if an error occurs.
§Errors
An EvalError is returned if a variable is not provided.
§Example
use xprs::Xprs;
use std::collections::HashMap;
let expression = "2 * x + y";
let xprs = Xprs::try_from(expression)?;
let mut variable_values = HashMap::new();
variable_values.insert("x", 3.0);
variable_values.insert("y", 2.0);
let result = xprs.eval(&variable_values);
assert_eq!(result, Ok(8.0));
// we didn't provide the variables, so this should fail
let failed_eval = xprs.eval(&HashMap::new());
assert!(failed_eval.is_err());Sourcepub fn eval_unchecked(&self, variables: &HashMap<&str, f64>) -> f64
pub fn eval_unchecked(&self, variables: &HashMap<&str, f64>) -> f64
Evaluates the expression using the provided variable values without error handling.
Returns an f64 if the evaluation is successful, or panics if an error occurs.
§Panic
Use with caution, as it may panic if variable(s) are missing.
§Example
use xprs::Xprs;
use std::collections::HashMap;
let expression = "2 * x + y";
let xprs = Xprs::try_from(expression)?;
let mut variable_values = HashMap::new();
variable_values.insert("x", 3.0);
variable_values.insert("y", 2.0);
let result = xprs.eval_unchecked(&variable_values);
assert_eq!(result, 8.0);
// we didn't provide the variables, so this should panic
assert_panic!(xprs.eval_unchecked(&HashMap::new()));Sourcepub fn simplify_for_in_place(&mut self, var: (&str, f64))
pub fn simplify_for_in_place(&mut self, var: (&str, f64))
Simplifies the expression in-place for a single variable.
§Example
use xprs::Xprs;
let expression = "2 * x + y";
let mut xprs = Xprs::try_from(expression)?;
assert_eq!(format!("{xprs}"), "((2 * x) + y)");
assert_eq!(xprs.vars, ["x", "y"].into());
xprs.simplify_for_in_place(("x", 3.0));
assert_eq!(format!("{xprs}"), "(6 + y)");
assert_eq!(xprs.vars, ["y"].into());Sourcepub fn eval_no_vars(&self) -> Result<f64, EvalError>
pub fn eval_no_vars(&self) -> Result<f64, EvalError>
Simple wrapper around Xprs::eval that doesn’t require any variables.
This will obviously fail if the expression contains variables.
§Errors
An EvalError is returned if the expression contains variables.
Sourcepub fn eval_no_vars_unchecked(&self) -> f64
pub fn eval_no_vars_unchecked(&self) -> f64
Simple wrapper around Xprs::eval_unchecked that doesn’t require any variables.
This will obviously fail if the expression contains variables.
§Panic
Use with caution, as it may panic if the expression contains variables.
Sourcepub fn simplify_for(self, var: (&str, f64)) -> Self
pub fn simplify_for(self, var: (&str, f64)) -> Self
Simplifies the expression in-place for a single variable and returns the expression.
§Example
use xprs::Xprs;
let expression = "2 * x + y";
let xprs = Xprs::try_from(expression)?;
assert_eq!(format!("{xprs}"), "((2 * x) + y)");
assert_eq!(xprs.vars, ["x", "y"].into());
let simplified_xprs = xprs.simplify_for(("x", 3.0));
assert_eq!(format!("{simplified_xprs}"), "(6 + y)");
assert_eq!(simplified_xprs.vars, ["y"].into());Sourcepub fn simplify_for_multiple_in_place(&mut self, vars: &[(&str, f64)])
pub fn simplify_for_multiple_in_place(&mut self, vars: &[(&str, f64)])
Simplifies the expression in-place for multiple variables.
§Example
use xprs::Xprs;
let expression = "2 * x + y + 4z";
let mut xprs = Xprs::try_from(expression)?;
assert_eq!(format!("{xprs}"), "(((2 * x) + y) + (4 * z))");
assert_eq!(xprs.vars, ["x", "y", "z"].into());
xprs.simplify_for_multiple_in_place(&[("x", 3.0), ("z", 2.0)]);
assert_eq!(format!("{xprs}"), "((6 + y) + 8)");
assert_eq!(xprs.vars, ["y"].into());Sourcepub fn simplify_for_multiple(self, vars: &[(&str, f64)]) -> Self
pub fn simplify_for_multiple(self, vars: &[(&str, f64)]) -> Self
Simplifies the expression in-place for multiple variables and returns the expression.
§Example
use xprs::Xprs;
let expression = "2 * x + y + 4z";
let xprs = Xprs::try_from(expression)?;
assert_eq!(format!("{xprs}"), "(((2 * x) + y) + (4 * z))");
assert_eq!(xprs.vars, ["x", "y", "z"].into());
let simplified_xprs = xprs.simplify_for_multiple(&[("x", 3.0), ("z", 2.0)]);
assert_eq!(format!("{simplified_xprs}"), "((6 + y) + 8)");
assert_eq!(simplified_xprs.vars, ["y"].into());Source§impl<'a> Xprs<'a>
impl<'a> Xprs<'a>
Sourcepub fn bind(self, var: &'a str) -> Result<impl Fn(f64) -> f64 + 'a, BindError>
pub fn bind(self, var: &'a str) -> Result<impl Fn(f64) -> f64 + 'a, BindError>
Creates a function of one variable based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("x + 2")?;
let func = expression.bind("x");
assert!(func.is_ok());
let func = func?;
let result = func(3.0);
assert_eq!(result, 5.0);Sourcepub fn bind2(
self,
var1: &'a str,
var2: &'a str,
) -> Result<impl Fn(f64, f64) -> f64 + 'a, BindError>
pub fn bind2( self, var1: &'a str, var2: &'a str, ) -> Result<impl Fn(f64, f64) -> f64 + 'a, BindError>
Creates a function of two f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("x + y")?;
let func = expression.bind2("x", "y");
assert!(func.is_ok());
let func = func?;
let result = func(3.0, 2.0);
assert_eq!(result, 5.0);Sourcepub fn bind3(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
) -> Result<impl Fn(f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind3( self, var1: &'a str, var2: &'a str, var3: &'a str, ) -> Result<impl Fn(f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of three f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("x + y + z")?;
let func = expression.bind3("x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(3.0, 2.0, 1.0);
assert_eq!(result, 6.0);Sourcepub fn bind4(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
var4: &'a str,
) -> Result<impl Fn(f64, f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind4( self, var1: &'a str, var2: &'a str, var3: &'a str, var4: &'a str, ) -> Result<impl Fn(f64, f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of four f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("w + x + y + z")?;
let func = expression.bind4("w", "x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(1.0, 2.0, 3.0, 4.0);
assert_eq!(result, 10.0);Sourcepub fn bind5(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
var4: &'a str,
var5: &'a str,
) -> Result<impl Fn(f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind5( self, var1: &'a str, var2: &'a str, var3: &'a str, var4: &'a str, var5: &'a str, ) -> Result<impl Fn(f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of five f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("v + w + x + y + z")?;
let func = expression.bind5("v", "w", "x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(1.0, 2.0, 3.0, 4.0, 5.0);
assert_eq!(result, 15.0);Sourcepub fn bind6(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
var4: &'a str,
var5: &'a str,
var6: &'a str,
) -> Result<impl Fn(f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind6( self, var1: &'a str, var2: &'a str, var3: &'a str, var4: &'a str, var5: &'a str, var6: &'a str, ) -> Result<impl Fn(f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of six f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("u + v + w + x + y + z")?;
let func = expression.bind6("u", "v", "w", "x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
assert_eq!(result, 21.0);Sourcepub fn bind7(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
var4: &'a str,
var5: &'a str,
var6: &'a str,
var7: &'a str,
) -> Result<impl Fn(f64, f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind7( self, var1: &'a str, var2: &'a str, var3: &'a str, var4: &'a str, var5: &'a str, var6: &'a str, var7: &'a str, ) -> Result<impl Fn(f64, f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of seven f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("t + u + v + w + x + y + z")?;
let func = expression.bind7("t", "u", "v", "w", "x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0);
assert_eq!(result, 28.0);Sourcepub fn bind8(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
var4: &'a str,
var5: &'a str,
var6: &'a str,
var7: &'a str,
var8: &'a str,
) -> Result<impl Fn(f64, f64, f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind8( self, var1: &'a str, var2: &'a str, var3: &'a str, var4: &'a str, var5: &'a str, var6: &'a str, var7: &'a str, var8: &'a str, ) -> Result<impl Fn(f64, f64, f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of eight f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("s + t + u + v + w + x + y + z")?;
let func = expression.bind8("s", "t", "u", "v", "w", "x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
assert_eq!(result, 36.0);Sourcepub fn bind9(
self,
var1: &'a str,
var2: &'a str,
var3: &'a str,
var4: &'a str,
var5: &'a str,
var6: &'a str,
var7: &'a str,
var8: &'a str,
var9: &'a str,
) -> Result<impl Fn(f64, f64, f64, f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
pub fn bind9( self, var1: &'a str, var2: &'a str, var3: &'a str, var4: &'a str, var5: &'a str, var6: &'a str, var7: &'a str, var8: &'a str, var9: &'a str, ) -> Result<impl Fn(f64, f64, f64, f64, f64, f64, f64, f64, f64) -> f64 + 'a, BindError>
Creates a function of nine f64 based on this Xprs instance.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("r + s + t + u + v + w + x + y + z")?;
let func = expression.bind9("r", "s", "t", "u", "v", "w", "x", "y", "z");
assert!(func.is_ok());
let func = func?;
let result = func(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);
assert_eq!(result, 45.0);Sourcepub fn bind_n<const T: usize>(
self,
vars: [&'a str; T],
) -> Result<impl Fn([f64; T]) -> f64 + 'a, BindError>
pub fn bind_n<const T: usize>( self, vars: [&'a str; T], ) -> Result<impl Fn([f64; T]) -> f64 + 'a, BindError>
Creates a function of any number* of f64 based on this Xprs instance.
*The number of variables must be known at compile time.
The returned closure takes an array of f64 as input and returns an f64.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("a + b + c + d")?;
let func = expression.bind_n(["a", "b", "c", "d"]);
assert!(func.is_ok());
let func = func?;
let result = func([1.0, 2.0, 3.0, 4.0]);
assert_eq!(result, 10.0);Sourcepub fn bind_n_runtime(
self,
vars: &'a [&'a str],
) -> Result<impl Fn(&[f64]) -> Result<f64, EvalError> + 'a, BindError>
pub fn bind_n_runtime( self, vars: &'a [&'a str], ) -> Result<impl Fn(&[f64]) -> Result<f64, EvalError> + 'a, BindError>
Creates a function of any number of f64 based on this Xprs instance.
The returned closure takes a slice of f64 as input and
returns a Result containing an f64 if the evaluation is successful, or an EvalError if an error occurs.
§Errors
A BindError is returned if one or more required variables were not provided.
§Example
use xprs::Parser;
let expression = Parser::default().parse("a + b + c + d")?;
let func = expression.bind_n_runtime(&["a", "b", "c", "d"]);
assert!(func.is_ok());
let func = func?;
let result = func(&[1.0, 2.0, 3.0, 4.0])?;
assert_eq!(result, 10.0);Trait Implementations§
impl<'a> StructuralPartialEq for Xprs<'a>
Auto Trait Implementations§
impl<'a> Freeze for Xprs<'a>
impl<'a> !RefUnwindSafe for Xprs<'a>
impl<'a> Send for Xprs<'a>
impl<'a> Sync for Xprs<'a>
impl<'a> Unpin for Xprs<'a>
impl<'a> !UnwindSafe for Xprs<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more