#[non_exhaustive]pub enum Compounding {
Periodic,
Continuous,
}Expand description
How interest compounds in a TVM calculation.
Prefer this enum over a bare bool. For ergonomics, false converts to
Compounding::Periodic and true to Compounding::Continuous.
§Examples
use finance_solution::Compounding;
assert_eq!(Compounding::from(false), Compounding::Periodic);
assert_eq!(Compounding::from(true), Compounding::Continuous);
assert!(Compounding::Continuous.is_continuous());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Periodic
Discrete compounding: fv = pv * (1 + r)^n (with this crate’s sign convention).
Continuous
Continuous compounding: fv = pv * e^(r * n).
Implementations§
Source§impl Compounding
impl Compounding
Sourcepub fn is_continuous(self) -> bool
pub fn is_continuous(self) -> bool
true if this is continuous compounding.
Sourcepub fn is_periodic(self) -> bool
pub fn is_periodic(self) -> bool
true if this is periodic (discrete) compounding.
Trait Implementations§
Source§impl Clone for Compounding
impl Clone for Compounding
Source§fn clone(&self) -> Compounding
fn clone(&self) -> Compounding
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 Compounding
Source§impl Debug for Compounding
impl Debug for Compounding
impl Eq for Compounding
Source§impl From<Compounding> for bool
impl From<Compounding> for bool
Source§fn from(c: Compounding) -> bool
fn from(c: Compounding) -> bool
true if continuous.
Source§impl From<bool> for Compounding
impl From<bool> for Compounding
Source§impl Hash for Compounding
impl Hash for Compounding
Source§impl PartialEq for Compounding
impl PartialEq for Compounding
impl StructuralPartialEq for Compounding
Auto Trait Implementations§
impl Freeze for Compounding
impl RefUnwindSafe for Compounding
impl Send for Compounding
impl Sync for Compounding
impl Unpin for Compounding
impl UnsafeUnpin for Compounding
impl UnwindSafe for Compounding
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