Skip to main content

CostReport

Struct CostReport 

Source
pub struct CostReport { /* private fields */ }
Expand description

Per-phase attribution for one sandbox, measured or projected.

Holds the rate table it was computed against rather than reaching for the pinned default, so a report stays readable — and reproducible — after pinned_rates is updated.

Implementations§

Source§

impl CostReport

Source

pub fn label(&self) -> &str

What this report is of, for a header.

Source

pub fn size(&self) -> SizeClass

The class every compute figure here was billed at (COST-5).

Source

pub fn rates(&self) -> &RateTable

The table these figures were computed against.

Source

pub fn items(&self) -> &[LineItem]

Every line item, in lifecycle order.

Source

pub fn staleness(&self) -> Option<&str>

The staleness warning, when the table was stale at computation time (COST-7).

Carried on the report because the warning has to survive into whatever renders it: a library caller with a log filter and a CLI that only wrote stderr would each lose it on their own.

Source

pub fn priced(&self) -> impl Iterator<Item = &LineItem>

The line items with a published rate.

Source

pub fn unpriced(&self) -> impl Iterator<Item = &LineItem>

The line items with no published rate.

Source

pub fn total(&self) -> Total

The total, which is a lower bound whenever anything is unpriced (COST-4).

Source

pub fn is_complete(&self) -> bool

False whenever any phase has no published rate. See Total.

Source

pub fn fully_measured(&self) -> bool

True only if every duration was timed. An estimate is never this (COST-10).

Source

pub fn by_phase(&self, phase: CostPhase) -> impl Iterator<Item = &LineItem>

The line items belonging to one phase.

Source

pub fn render(&self) -> String

Plain text for a CLI. Leads with what the dollars are, not the dollars.

The header is not decoration: a figure copied out of a terminal loses its docstring, so the estimate label and the retrieval date travel with it.

Source§

impl CostReport

Source

pub fn to_json(&self) -> Value

The report as JSON, keeping every label it carries.

The keys are the retired Python client’s report_to_dict verbatim, plus one added since (#99): size.headroomMib. A new key is safe where a rename isn’t, because the live suite asserts presence, never absence.

Trait Implementations§

Source§

impl Clone for CostReport

Source§

fn clone(&self) -> CostReport

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 CostReport

Source§

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

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

impl Eq for CostReport

Source§

impl PartialEq for CostReport

Source§

fn eq(&self, other: &CostReport) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CostReport

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> Same for T

Source§

type Output = T

Should always be Self
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.