pub enum PaymentTiming {
EndOfPeriod,
BeginningOfPeriod,
}Expand description
When a level payment (annuity installment) falls within each period.
Prefer this enum over a bare bool. For ergonomics, false converts to
PaymentTiming::EndOfPeriod and true to PaymentTiming::BeginningOfPeriod
(Excel type=0 / type=1).
§Examples
use finance_solution::{payment, PaymentTiming};
let end = payment(0.01, 12, 1_000.0, 0.0, PaymentTiming::EndOfPeriod).unwrap();
let end_bool = payment(0.01, 12, 1_000.0, 0.0, false).unwrap();
assert!((end - end_bool).abs() < 1e-12);
let due = payment(0.01, 12, 1_000.0, 0.0, true).unwrap();
assert!(due.abs() < end.abs()); // due payments are slightly smaller in magnitudeVariants§
EndOfPeriod
Payment at the end of each period (ordinary annuity). Default / Excel type=0.
BeginningOfPeriod
Payment at the beginning of each period (annuity due). Excel type=1.
Implementations§
Source§impl PaymentTiming
impl PaymentTiming
Trait Implementations§
Source§impl Clone for PaymentTiming
impl Clone for PaymentTiming
Source§fn clone(&self) -> PaymentTiming
fn clone(&self) -> PaymentTiming
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PaymentTiming
Source§impl Debug for PaymentTiming
impl Debug for PaymentTiming
Source§impl Default for PaymentTiming
impl Default for PaymentTiming
Source§fn default() -> PaymentTiming
fn default() -> PaymentTiming
Returns the “default value” for a type. Read more
Source§impl Display for PaymentTiming
impl Display for PaymentTiming
impl Eq for PaymentTiming
Source§impl From<PaymentTiming> for bool
impl From<PaymentTiming> for bool
Source§fn from(timing: PaymentTiming) -> bool
fn from(timing: PaymentTiming) -> bool
Converts to this type from the input type.
Source§impl From<bool> for PaymentTiming
impl From<bool> for PaymentTiming
Source§impl Hash for PaymentTiming
impl Hash for PaymentTiming
Source§impl PartialEq for PaymentTiming
impl PartialEq for PaymentTiming
impl StructuralPartialEq for PaymentTiming
Auto Trait Implementations§
impl Freeze for PaymentTiming
impl RefUnwindSafe for PaymentTiming
impl Send for PaymentTiming
impl Sync for PaymentTiming
impl Unpin for PaymentTiming
impl UnsafeUnpin for PaymentTiming
impl UnwindSafe for PaymentTiming
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
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> ⓘ
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 more