pub struct LineItem {
pub phase: CostPhase,
pub line: Option<BillingLine>,
pub quantity: Decimal,
pub unit: String,
pub amount: Amount,
pub duration: Option<DurationP>,
pub note: String,
}Expand description
One phase’s one billing line: what was consumed, and what that costs.
quantity and unit are kept beside amount so a reader can check the
arithmetic against the rate table instead of trusting the total, which is the only
defence against a rate that drifts out of date without anyone noticing.
Fields§
§phase: CostPhase§line: Option<BillingLine>None only for a phase with no published rate to attribute it to.
quantity: Decimal§unit: String§amount: Amount§duration: Option<DurationP>§note: StringImplementations§
Source§impl LineItem
impl LineItem
Sourcepub fn quantity_string(&self) -> String
pub fn quantity_string(&self) -> String
The quantity at display precision, for a CLI column.
Source§impl LineItem
impl LineItem
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
The line as JSON: phase, line, quantity, unit, amount, duration, note.
The keys are the retired Python client’s _line_to_dict, because the live suite reads
them and every surface’s output has to be substitutable. amount is
{"kind": "estimated-usd", "usd": "<decimal>"} or {"kind": "unpriced", "reason": "..."}, with no usd key.
Trait Implementations§
impl Eq for LineItem
impl StructuralPartialEq for LineItem
Auto Trait Implementations§
impl Freeze for LineItem
impl RefUnwindSafe for LineItem
impl Send for LineItem
impl Sync for LineItem
impl Unpin for LineItem
impl UnsafeUnpin for LineItem
impl UnwindSafe for LineItem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.