pub struct Cost<B>where
B: BookingTypes,{
pub date: B::Date,
pub per_unit: B::Number,
pub total: B::Number,
pub currency: B::Currency,
pub label: Option<B::Label>,
pub merge: bool,
}Expand description
A cost complete with any fields which were missing from its CostSpec.
In addition to per-unit which is the natural representation, the total
is also exposed, since this may be what the user originally specified in the
beanfile, and ought to be preserved at its original precision.
Fields§
§date: B::Date§per_unit: B::Number§total: B::Number§currency: B::Currency§label: Option<B::Label>§merge: boolTrait Implementations§
Source§impl<B> Display for Cost<B>where
B: BookingTypes,
impl<B> Display for Cost<B>where
B: BookingTypes,
Source§impl<B> From<(&<B as BookingTypes>::Currency, &PostingCost<B>)> for Cost<B>where
B: BookingTypes,
impl<B> From<(&<B as BookingTypes>::Currency, &PostingCost<B>)> for Cost<B>where
B: BookingTypes,
Source§fn from(value: (&B::Currency, &PostingCost<B>)) -> Self
fn from(value: (&B::Currency, &PostingCost<B>)) -> Self
Source§impl<B> Hash for Cost<B>where
B: BookingTypes,
impl<B> Hash for Cost<B>where
B: BookingTypes,
Source§impl<B> Ord for Cost<B>
impl<B> Ord for Cost<B>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<B> PartialEq for Cost<B>where
B: BookingTypes,
impl<B> PartialEq for Cost<B>where
B: BookingTypes,
Source§impl<B> PartialOrd for Cost<B>
impl<B> PartialOrd for Cost<B>
impl<B> Eq for Cost<B>where
B: BookingTypes,
Auto Trait Implementations§
impl<B> Freeze for Cost<B>where
<B as BookingTypes>::Date: Freeze,
<B as BookingTypes>::Number: Freeze,
<B as BookingTypes>::Currency: Freeze,
<B as BookingTypes>::Label: Freeze,
impl<B> RefUnwindSafe for Cost<B>where
<B as BookingTypes>::Date: RefUnwindSafe,
<B as BookingTypes>::Number: RefUnwindSafe,
<B as BookingTypes>::Currency: RefUnwindSafe,
<B as BookingTypes>::Label: RefUnwindSafe,
impl<B> Send for Cost<B>where
<B as BookingTypes>::Date: Send,
<B as BookingTypes>::Number: Send,
<B as BookingTypes>::Currency: Send,
<B as BookingTypes>::Label: Send,
impl<B> Sync for Cost<B>where
<B as BookingTypes>::Date: Sync,
<B as BookingTypes>::Number: Sync,
<B as BookingTypes>::Currency: Sync,
<B as BookingTypes>::Label: Sync,
impl<B> Unpin for Cost<B>where
<B as BookingTypes>::Date: Unpin,
<B as BookingTypes>::Number: Unpin,
<B as BookingTypes>::Currency: Unpin,
<B as BookingTypes>::Label: Unpin,
impl<B> UnsafeUnpin for Cost<B>where
<B as BookingTypes>::Date: UnsafeUnpin,
<B as BookingTypes>::Number: UnsafeUnpin,
<B as BookingTypes>::Currency: UnsafeUnpin,
<B as BookingTypes>::Label: UnsafeUnpin,
impl<B> UnwindSafe for Cost<B>where
<B as BookingTypes>::Date: UnwindSafe,
<B as BookingTypes>::Number: UnwindSafe,
<B as BookingTypes>::Currency: UnwindSafe,
<B as BookingTypes>::Label: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<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
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>
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>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
Source§impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
impl<T, S> SpanWrap<S> for Twhere
S: WrappingSpan<T>,
Source§fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
fn with_span(self, span: S) -> <S as WrappingSpan<Self>>::Spanned
WrappingSpan::make_wrapped to wrap an AST node in a span.