get_cached_expression

Function get_cached_expression 

Source
pub fn get_cached_expression(key: &'static str) -> Option<Expression>
Expand description

Get a commonly used expression from cache

Returns cached instances of frequently used expressions to avoid repeated construction.

§Examples

use mathhook_core::parser::cache::get_cached_expression;

let zero = get_cached_expression("0");
let pi = get_cached_expression("pi");

§Performance

  • O(1) HashMap lookup for cached expressions
  • Avoids repeated Expression construction for constants