pub struct FutureValue {
pub cash_flow: f64,
pub interest_rate: f64,
pub time_periods: f64,
}
Expand description
Calculates the future value of a cash flow received today
§Example
use com_croftsoft_core::math::finance_lib::FutureValue;
assert_eq!(
FutureValue {
cash_flow: 1.0, // Investing $1 today
interest_rate: 0.12, // At 12% per year
time_periods: 6.0, // For six years with interest compounded annually
}.calculate(),
1.973_822_685_184_001); // Will double your money (see the "Rule of 72")
Fields§
§cash_flow: f64
Cash flow invested or received today
interest_rate: f64
Interest, discount, or inflation rate (use 0.01 for 1%)
time_periods: f64
Number of periods from today when the value is evaluated
Implementations§
Trait Implementations§
Source§impl Clone for FutureValue
impl Clone for FutureValue
Source§fn clone(&self) -> FutureValue
fn clone(&self) -> FutureValue
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FutureValue
impl Debug for FutureValue
impl Copy for FutureValue
Auto Trait Implementations§
impl Freeze for FutureValue
impl RefUnwindSafe for FutureValue
impl Send for FutureValue
impl Sync for FutureValue
impl Unpin for FutureValue
impl UnwindSafe for FutureValue
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