pub struct DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,{ /* private fields */ }Expand description
The input data for the invoice, which includes information about the invoice, the vendor, and the client and the products/services included in the invoice.
Implementations§
Source§impl<Items> DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
impl<Items> DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
Sourcepub fn builder() -> DataFromDiskWithItemsOfKindBuilder<Items>
pub fn builder() -> DataFromDiskWithItemsOfKindBuilder<Items>
Create an instance of DataFromDiskWithItemsOfKind using the builder syntax
Source§impl<Items> DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
impl<Items> DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
Sourcepub fn information(&self) -> &InvoiceInfoFull
pub fn information(&self) -> &InvoiceInfoFull
Information about this specific invoice.
Sourcepub fn vendor(&self) -> &CompanyInformation
pub fn vendor(&self) -> &CompanyInformation
The company that issued the invoice, the vendor/seller/supplier/issuer.
Sourcepub fn client(&self) -> &CompanyInformation
pub fn client(&self) -> &CompanyInformation
The company that pays the invoice, the customer/buyer.
Sourcepub fn line_items(&self) -> &Items
pub fn line_items(&self) -> &Items
Services or expenses included in this invoice to be paid by the client.
Sourcepub fn payment_info(&self) -> &PaymentInformation
pub fn payment_info(&self) -> &PaymentInformation
Payment information for the vendor, used for international transfers. This includes the IBAN, bank name, and BIC. This is used to ensure that the client can pay the invoice correctly.
Source§impl<Items> DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
impl<Items> DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
Sourcepub fn absolute_path_and_name(&self) -> Result<PathAndName, Error>
pub fn absolute_path_and_name(&self) -> Result<PathAndName, Error>
Returns the absolute path where the invoice will be saved. If the path is relative, it will be created relative to the workspace root. If the path is absolute, it will be returned as is.
§Errors
Returns an error if the path is relative and the folder cannot be created, or if the path is absolute but invalid.
§Examples
extern crate klirr_core;
use klirr_core::prelude::*;
let data = DataWithItemsPricedInSourceCurrency::builder()
.information(InvoiceInfoFull::sample())
.vendor(CompanyInformation::sample())
.client(CompanyInformation::sample())
.line_items(LineItemsPricedInSourceCurrency::sample())
.payment_info(PaymentInformation::sample())
.output_path(OutputPath::Name("invoice.pdf".into()))
.build();
let path_and_name = data.absolute_path_and_name().unwrap();
assert!(path_and_name.path().ends_with("invoice.pdf"));
assert_eq!(path_and_name.name(), "invoice.pdf");Source§impl DataFromDiskWithItemsOfKind<LineItemsPricedInSourceCurrency>
impl DataFromDiskWithItemsOfKind<LineItemsPricedInSourceCurrency>
Sourcepub fn to_typst(
self,
exchange_rates: ExchangeRates,
) -> Result<DataFromDiskWithItemsOfKind<LineItemsFlat>, Error>
pub fn to_typst( self, exchange_rates: ExchangeRates, ) -> Result<DataFromDiskWithItemsOfKind<LineItemsFlat>, Error>
Converts the DataWithItemsPricedInSourceCurrency into a PreparedData
which is compatible with Typst rendering.
This method prepares the invoice data for rendering by creating an
ExchangeRates object and converting the line items into a flat structure.
§Errors
Returns an error if the line items cannot be converted to a flat structure.
§Examples
extern crate klirr_core;
use klirr_core::prelude::*;
let data = DataWithItemsPricedInSourceCurrency::sample();
let exchange_rates = ExchangeRates::builder().rates(ExchangeRatesMap::from_iter([(Currency::GBP, UnitPrice::from(dec!(10.0))), (Currency::EUR, UnitPrice::from(dec!(8.0)))])).target_currency(Currency::EUR).build();
let result = data.to_typst(exchange_rates);
assert!(result.is_ok(), "Expected conversion to succeed, got: {:?}", result);Trait Implementations§
Source§impl<Items> Clone for DataFromDiskWithItemsOfKind<Items>
impl<Items> Clone for DataFromDiskWithItemsOfKind<Items>
Source§fn clone(&self) -> DataFromDiskWithItemsOfKind<Items>
fn clone(&self) -> DataFromDiskWithItemsOfKind<Items>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<Items> Debug for DataFromDiskWithItemsOfKind<Items>
impl<Items> Debug for DataFromDiskWithItemsOfKind<Items>
Source§impl<'de, Items> Deserialize<'de> for DataFromDiskWithItemsOfKind<Items>
impl<'de, Items> Deserialize<'de> for DataFromDiskWithItemsOfKind<Items>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DataFromDiskWithItemsOfKind<Items>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DataFromDiskWithItemsOfKind<Items>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl<Items> Eq for DataFromDiskWithItemsOfKind<Items>
Source§impl<Items> HasSample for DataFromDiskWithItemsOfKind<Items>
impl<Items> HasSample for DataFromDiskWithItemsOfKind<Items>
Source§fn sample() -> DataFromDiskWithItemsOfKind<Items>
fn sample() -> DataFromDiskWithItemsOfKind<Items>
fn sample_other() -> DataFromDiskWithItemsOfKind<Items>
Source§impl<Items> Hash for DataFromDiskWithItemsOfKind<Items>
impl<Items> Hash for DataFromDiskWithItemsOfKind<Items>
Source§impl<Items> PartialEq for DataFromDiskWithItemsOfKind<Items>
impl<Items> PartialEq for DataFromDiskWithItemsOfKind<Items>
Source§fn eq(&self, other: &DataFromDiskWithItemsOfKind<Items>) -> bool
fn eq(&self, other: &DataFromDiskWithItemsOfKind<Items>) -> bool
self and other values to be equal, and is used by ==.Source§impl<Items> Serialize for DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
impl<Items> Serialize for DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<Items> StructuralPartialEq for DataFromDiskWithItemsOfKind<Items>where
Items: Serialize + MaybeIsExpenses,
impl ToTypst for DataFromDiskWithItemsOfKind<LineItemsFlat>
Auto Trait Implementations§
impl<Items> Freeze for DataFromDiskWithItemsOfKind<Items>where
Items: Freeze,
impl<Items> RefUnwindSafe for DataFromDiskWithItemsOfKind<Items>where
Items: RefUnwindSafe,
impl<Items> Send for DataFromDiskWithItemsOfKind<Items>where
Items: Send,
impl<Items> Sync for DataFromDiskWithItemsOfKind<Items>where
Items: Sync,
impl<Items> Unpin for DataFromDiskWithItemsOfKind<Items>where
Items: Unpin,
impl<Items> UnsafeUnpin for DataFromDiskWithItemsOfKind<Items>where
Items: UnsafeUnpin,
impl<Items> UnwindSafe for DataFromDiskWithItemsOfKind<Items>where
Items: UnwindSafe,
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.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, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
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> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.impl<T> MaybeSendSync for T
impl<T> OrderedContainer<T> for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> ToTypstFn for T
impl<T> ToTypstFn for T
Source§fn to_typst_fn(&self) -> String
fn to_typst_fn(&self) -> String
Converts this Serializeable Rust struct into Typst syntax.
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more