Struct Invoice
pub struct Invoice { /* private fields */ }Expand description
A general invoice with same-currency line totals.
Implementations§
§impl Invoice
impl Invoice
pub fn from_lines(
number: InvoiceNumber,
lines: Vec<InvoiceLine>,
) -> Result<Invoice, InvoiceError>
pub fn from_lines( number: InvoiceNumber, lines: Vec<InvoiceLine>, ) -> Result<Invoice, InvoiceError>
Creates an open invoice from same-currency lines.
§Errors
Returns [InvoiceError::NoLines] when no lines are supplied and [InvoiceError::Money]
when line totals cannot be added.
pub fn new(
number: InvoiceNumber,
status: InvoiceStatus,
due_date: Option<DueDate>,
lines: Vec<InvoiceLine>,
) -> Result<Invoice, InvoiceError>
pub fn new( number: InvoiceNumber, status: InvoiceStatus, due_date: Option<DueDate>, lines: Vec<InvoiceLine>, ) -> Result<Invoice, InvoiceError>
Creates an invoice from same-currency lines.
§Errors
Returns [InvoiceError::NoLines] when no lines are supplied and [InvoiceError::Money]
when line totals cannot be added.
pub fn with_due_date(self, due_date: DueDate) -> Invoice
pub fn with_due_date(self, due_date: DueDate) -> Invoice
Returns a copy of this invoice with a due date.
pub fn with_amount_paid(
self,
amount_paid: &Money,
) -> Result<Invoice, InvoiceError>
pub fn with_amount_paid( self, amount_paid: &Money, ) -> Result<Invoice, InvoiceError>
Returns a copy of this invoice with an amount paid applied to the balance due.
§Errors
Returns [InvoiceError::Money] when the payment currency or amount scale is incompatible.
pub const fn number(&self) -> &InvoiceNumber
pub const fn number(&self) -> &InvoiceNumber
Returns the invoice number.
pub const fn status(&self) -> InvoiceStatus
pub const fn status(&self) -> InvoiceStatus
Returns the invoice status.
pub fn lines(&self) -> &[InvoiceLine]
pub fn lines(&self) -> &[InvoiceLine]
Returns the invoice lines.
pub fn iter(&self) -> Iter<'_, InvoiceLine>
pub fn iter(&self) -> Iter<'_, InvoiceLine>
Iterates over invoice lines.
pub const fn balance_due(&self) -> &BalanceDue
pub const fn balance_due(&self) -> &BalanceDue
Returns the balance due.
Trait Implementations§
§impl<'a> IntoIterator for &'a Invoice
impl<'a> IntoIterator for &'a Invoice
§type Item = &'a InvoiceLine
type Item = &'a InvoiceLine
The type of the elements being iterated over.
§type IntoIter = Iter<'a, InvoiceLine>
type IntoIter = Iter<'a, InvoiceLine>
Which kind of iterator are we turning this into?
impl Eq for Invoice
impl StructuralPartialEq for Invoice
Auto Trait Implementations§
impl Freeze for Invoice
impl RefUnwindSafe for Invoice
impl Send for Invoice
impl Sync for Invoice
impl Unpin for Invoice
impl UnsafeUnpin for Invoice
impl UnwindSafe for Invoice
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