#[non_exhaustive]pub enum RatesError {
NotFinite {
prompt_usd_per_1k: f64,
completion_usd_per_1k: f64,
},
Negative {
prompt_usd_per_1k: f64,
completion_usd_per_1k: f64,
},
CacheRateInvalid {
cache_read_usd_per_1k: f64,
cache_creation_usd_per_1k: f64,
},
}Expand description
Validation failure for Rates construction.
Returned by Rates::try_new and PriceTable::set when a rate field
is non-finite (NaN, +inf, -inf) or negative. Negative or non-finite
rates would silently corrupt downstream USD totals — billing-grade input
validation rejects them at the boundary.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
NotFinite
One of the rate fields was NaN or infinite.
Fields
Negative
One of the rate fields was negative.
Fields
CacheRateInvalid
A cache-tier rate was non-finite or negative.
Trait Implementations§
Source§impl Clone for RatesError
impl Clone for RatesError
Source§fn clone(&self) -> RatesError
fn clone(&self) -> RatesError
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 RatesError
impl Debug for RatesError
Source§impl Display for RatesError
impl Display for RatesError
Source§impl Error for RatesError
impl Error for RatesError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl PartialEq for RatesError
impl PartialEq for RatesError
impl StructuralPartialEq for RatesError
Auto Trait Implementations§
impl Freeze for RatesError
impl RefUnwindSafe for RatesError
impl Send for RatesError
impl Sync for RatesError
impl Unpin for RatesError
impl UnsafeUnpin for RatesError
impl UnwindSafe for RatesError
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