pub enum PriceAnnotationView<'a> {
Unit(&'a AmountData),
Total(&'a AmountData),
UnitIncomplete {
number: Option<&'a str>,
currency: Option<&'a str>,
},
TotalIncomplete {
number: Option<&'a str>,
currency: Option<&'a str>,
},
}Expand description
Typed view of a PriceAnnotationData.
Each arm distinguishes per-unit (@) from total (@@) at the
type level, so a match on the view forces consumers to
handle both cases. This is the recommended way to consume price
annotations — see the docstring on PriceAnnotationData for the
motivating bug.
Variants§
Unit(&'a AmountData)
@ AMOUNT — per-unit price with a complete amount.
Total(&'a AmountData)
@@ AMOUNT — total price with a complete amount.
Consumers that compute prices MUST divide by the posting’s
units.number.abs() to recover the per-unit price. See
rustledger_core::extract_per_unit_price (in the
rustledger-core crate; not linked because that crate is not a
dependency of rustledger-plugin-types).
UnitIncomplete
@ NUMBER / @ CURRENCY — per-unit annotation missing one
or both of (number, currency).
Fields
TotalIncomplete
@@ NUMBER / @@ CURRENCY — incomplete total annotation.
Trait Implementations§
Source§impl<'a> Clone for PriceAnnotationView<'a>
impl<'a> Clone for PriceAnnotationView<'a>
Source§fn clone(&self) -> PriceAnnotationView<'a>
fn clone(&self) -> PriceAnnotationView<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for PriceAnnotationView<'a>
impl<'a> Debug for PriceAnnotationView<'a>
impl<'a> Copy for PriceAnnotationView<'a>
Auto Trait Implementations§
impl<'a> Freeze for PriceAnnotationView<'a>
impl<'a> RefUnwindSafe for PriceAnnotationView<'a>
impl<'a> Send for PriceAnnotationView<'a>
impl<'a> Sync for PriceAnnotationView<'a>
impl<'a> Unpin for PriceAnnotationView<'a>
impl<'a> UnsafeUnpin for PriceAnnotationView<'a>
impl<'a> UnwindSafe for PriceAnnotationView<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.