pub struct NpvSolution { /* private fields */ }Expand description
The custom solution information of a NPV scenario. The struct values are immutable by the user of the library.
Implementations§
Source§impl NpvSolution
impl NpvSolution
Sourcepub fn new(
rates: Vec<f64>,
periods: u32,
initial_investment: f64,
cashflows: Vec<f64>,
sum_of_cashflows: f64,
sum_of_discounted_cashflows: f64,
net_present_value: f64,
) -> Self
pub fn new( rates: Vec<f64>, periods: u32, initial_investment: f64, cashflows: Vec<f64>, sum_of_cashflows: f64, sum_of_discounted_cashflows: f64, net_present_value: f64, ) -> Self
Create a new instance of the struct
pub fn series(&self) -> NpvSeries
Sourcepub fn rate_avg(&self) -> f64
pub fn rate_avg(&self) -> f64
Call rate_avg on a NpvSolution to get the simple average rate of a schedule;
Sourcepub fn initial_investment(&self) -> f64
pub fn initial_investment(&self) -> f64
Returns the initial investment as f64.
Sourcepub fn sum_of_cashflows(&self) -> f64
pub fn sum_of_cashflows(&self) -> f64
Returns the sum of the cashflows at their future value.
Sourcepub fn sum_of_discounted_cashflows(&self) -> f64
pub fn sum_of_discounted_cashflows(&self) -> f64
Returns the sum of the cashflows at their present value.
Sourcepub fn net_present_value(&self) -> f64
pub fn net_present_value(&self) -> f64
Returns the net present value as f64.
Sourcepub fn print_table(&self)
pub fn print_table(&self)
Pretty-print a table of the calculations at each period for visual analysis.
Sourcepub fn print_table_locale(&self, locale: &Locale, precision: usize)
pub fn print_table_locale(&self, locale: &Locale, precision: usize)
Pretty-print a table of the calculations at each period for visual analysis, and provide a Locale for monetary formatting and preferred decimal precision.
Sourcepub fn max_discounted_cashflow(&self) -> Option<f64>
pub fn max_discounted_cashflow(&self) -> Option<f64>
Max discounted cashflow among periods after the initial investment, if any.
Sourcepub fn min_discounted_cashflow(&self) -> Option<f64>
pub fn min_discounted_cashflow(&self) -> Option<f64>
Min discounted cashflow among periods after the initial investment, if any.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NpvSolution
impl RefUnwindSafe for NpvSolution
impl Send for NpvSolution
impl Sync for NpvSolution
impl Unpin for NpvSolution
impl UnsafeUnpin for NpvSolution
impl UnwindSafe for NpvSolution
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
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 more