Skip to main content

Catalog

Struct Catalog 

Source
pub struct Catalog {
    pub extracted_at: String,
    pub source: String,
    pub currency: String,
    pub afp_yuan: f64,
    pub windows: WindowShare,
    pub plans: Vec<Plan>,
    pub enterprise: Vec<Enterprise>,
    pub models: Vec<Model>,
    pub media: Vec<Media>,
    pub harness: Vec<Media>,
    pub notes: BTreeMap<String, String>,
}

Fields§

§extracted_at: String§source: String§currency: String§afp_yuan: f64

Yuan per AFP — 0.002 at every tier.

§windows: WindowShare§plans: Vec<Plan>§enterprise: Vec<Enterprise>§models: Vec<Model>§media: Vec<Media>§harness: Vec<Media>§notes: BTreeMap<String, String>

Implementations§

Source§

impl Catalog

Source

pub fn plan(&self, plan_id: &str) -> Option<&Plan>

Source

pub fn plan_ids(&self) -> Vec<&str>

Source

pub fn grants(&self, plan_id: &str, min_plan: &str) -> bool

The tier a model needs, compared by rank so --plan large grants a Medium-only model too.

Source

pub fn coef_at(&self, model: &Model, at_ms: i64) -> f64

The coefficient in force at at_ms: a promo halves it until its own date.

Source

pub fn afp( &self, model_id: &str, at_ms: i64, input: u64, cache_read: u64, output: u64, ) -> Option<f64>

AFP for one text/embedding turn, or None for a model with no coefficient (unknown, or media which meters in its own unit).

Cache-read tokens are billed: measured on this account, cache-excluded arithmetic gave 40.9 AFP against a 706.5 meter, cache-inclusive gave 705.2 — 0.2% apart.

Source

pub fn quota(&self, plan_id: &str) -> Option<f64>

The plan’s monthly AFP quota.

Source

pub fn yuan(&self, afp: f64) -> f64

Yuan for an AFP amount.

Trait Implementations§

Source§

impl Clone for Catalog

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Catalog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Catalog

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.