pub struct SimpleCostCalculator { /* private fields */ }Expand description
Simple Cost Calculator
Implementations§
Source§impl SimpleCostCalculator
impl SimpleCostCalculator
pub fn new() -> Result<Self>
pub fn estimate_cost( &self, model: String, input_tokens: u32, output_tokens: u32, ) -> Result<String>
pub fn check_budget(&self, spent: f64, budget: f64) -> Result<String>
pub fn project_monthly_cost( &self, model: String, daily_input: u32, daily_output: u32, days: f64, ) -> Result<String>
Trait Implementations§
Source§impl FromNapiMutRef for SimpleCostCalculator
impl FromNapiMutRef for SimpleCostCalculator
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Safety Read more
Source§impl FromNapiRef for SimpleCostCalculator
impl FromNapiRef for SimpleCostCalculator
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Safety Read more
Source§impl JavaScriptClassExt for SimpleCostCalculator
impl JavaScriptClassExt for SimpleCostCalculator
fn into_instance<'scope>( self, env: &'scope Env, ) -> Result<ClassInstance<'scope, Self>>
fn into_reference(self, env: Env) -> Result<Reference<Self>>
fn instance_of<'env, V: JsValue<'env>>(env: &Env, value: &V) -> Result<bool>
Source§impl ToNapiValue for SimpleCostCalculator
impl ToNapiValue for SimpleCostCalculator
Source§unsafe fn to_napi_value(
env: napi_env,
val: SimpleCostCalculator,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: SimpleCostCalculator, ) -> Result<napi_value>
Safety Read more
fn into_unknown(self, env: &Env) -> Result<Unknown<'_>, Error>
Source§impl TypeName for &SimpleCostCalculator
impl TypeName for &SimpleCostCalculator
Source§impl TypeName for &mut SimpleCostCalculator
impl TypeName for &mut SimpleCostCalculator
Source§impl TypeName for SimpleCostCalculator
impl TypeName for SimpleCostCalculator
Source§impl ValidateNapiValue for &SimpleCostCalculator
impl ValidateNapiValue for &SimpleCostCalculator
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &mut SimpleCostCalculator
impl ValidateNapiValue for &mut SimpleCostCalculator
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for SimpleCostCalculator
impl RefUnwindSafe for SimpleCostCalculator
impl Send for SimpleCostCalculator
impl Sync for SimpleCostCalculator
impl Unpin for SimpleCostCalculator
impl UnwindSafe for SimpleCostCalculator
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
Mutably borrows from an owned value. Read more