Struct SmartCalc

Source
pub struct SmartCalc { /* private fields */ }

Implementations§

Source§

impl SmartCalc

Source

pub fn add_dynamic_type<T: Borrow<str>>(&mut self, name: T) -> bool

Source

pub fn add_dynamic_type_item<T: Borrow<str>>( &mut self, name: T, index: usize, format: T, parse: Vec<T>, upgrade_code: T, downgrade_code: T, names: Vec<String>, decimal_digits: Option<u8>, use_fract_rounding: Option<bool>, remove_fract_if_zero: Option<bool>, ) -> bool

Source

pub fn set_money_configuration( &mut self, remove_fract_if_zero: bool, use_fract_rounding: bool, )

Source

pub fn set_number_configuration( &mut self, decimal_digits: u8, remove_fract_if_zero: bool, use_fract_rounding: bool, )

Source

pub fn set_percentage_configuration( &mut self, decimal_digits: u8, remove_fract_if_zero: bool, use_fract_rounding: bool, )

Source

pub fn set_decimal_seperator(&mut self, decimal_seperator: String)

Source

pub fn set_thousand_separator(&mut self, thousand_separator: String)

Source

pub fn set_date_rule(&mut self, language: &str, rules: Vec<String>)

Source

pub fn set_timezone(&mut self, timezone: String) -> Result<(), String>

Source

pub fn get_time_offset(&self) -> TimeOffset

Source

pub fn load_from_json(json_data: &str) -> Self

Source

pub fn update_currency(&mut self, currency: &str, rate: f64) -> bool

Source

pub fn delete_rule(&mut self, language: String, rule_name: String) -> bool

Source

pub fn add_rule( &mut self, language: String, rules: Vec<String>, rule: Rc<dyn RuleTrait>, ) -> bool

Source

pub fn format_result( &self, session: &Session, result: Rc<SmartCalcAstType>, ) -> String

Source

pub fn initialize()

Source

pub fn execute<Tlan: Borrow<str>, Tdata: Borrow<str>>( &self, language: Tlan, data: Tdata, ) -> ExecuteResult

Source

pub fn basic_execute<T: Borrow<str>>( data: T, config: &SmartCalcConfig, ) -> Result<f64>

Source

pub fn execute_session(&self, session: &Session) -> ExecuteResult

Trait Implementations§

Source§

impl Default for SmartCalc

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Send for SmartCalc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.