ListCashflow

Struct ListCashflow 

pub struct ListCashflow { /* private fields */ }

Implementations§

§

impl ListCashflow

List of currently active cashflows implementation.

pub fn new(calc_manager_param: &Rc<RefCell<CalcManager>>) -> ListCashflow

Create and return a new list cashflow.

§Arguments
  • calc_manager_param - Calculation manager.
§Return
  • See description.

pub fn add_cashflow_prep( &self, name_param: &str, list_event_param: Option<ListEvent>, elem_preferences_param: Option<ElemPreferences>, group_param: &str, ) -> Result<ElemCashflow, ErrorType>

Prepare to add a new cashflow into the cashflow list. If the name results in a duplicate entry, an incrementing number starting from 2 is appended to the name until a non-duplicate entry is found.

§Arguments
  • name_param - The name of the cashflow.
  • list_event_param - A newly created event list.
  • elem_preferences_param - Original existing preferences element (or None to initialize all preferences).
  • group_param - Optional template group name.
§Return
  • ElemCashflow if successful, otherwise error code.

pub fn add_cashflow(&mut self, elem_cashflow: ElemCashflow)

Add a new cashflow into the cashflow list.

§Arguments
  • elem_cashflow - Cashflow element to add.

pub fn append_cashflows(&mut self, list_cashflow: ListCashflow)

Append to the list cashflow.

§Arguments
  • list_cashflow - See description.

pub fn copy_with_calc_manager( &self, calc_manager_param: &Rc<RefCell<CalcManager>>, ) -> ListCashflow

Copy the list cashflow and return a new list cashflow.

§Arguments
  • calc_manager_param - Calculation manager.
§Return
  • See description.

pub fn create_cashflow_stats(&self) -> ElemCashflowStats

Create and return the cashflow statistics.

§Return
  • See description.

pub fn create_cashflow_output( &self, include_rollups: bool, include_details: bool, compress_descriptor: bool, omit_statistic_events: bool, updating_json: bool, ) -> Result<ListAmortization, ErrorType>

Create a cashflow for output from the currently selected cashflow. Create the cashflow by combining principal change events that are identical except their dates but maintain a periodic flow according to the original frequencies.

§Arguments
  • include_rollups - Include rollup elements.
  • include_details - Include detail elements.
  • compress_descriptor - If true merge ListDescriptor objects into a single ListDescriptor object where applicable, otherwise do not compress amortization elements that have different ListDescriptor objects.
  • omit_statistic_events - If true the statistic events are eliminated from the resulting event list.
  • updating_json - Updating from Json.
§Return
  • The resulting amortization list or an error code.

pub fn name(&self) -> &str

Get the name of the selected cashflow.

§Return
  • See description.

pub fn preferences(&self) -> Option<&ElemPreferences>

Get the preferences element of the selected cashflow.

§Return
  • See description.

pub fn preferences_mut(&mut self) -> Option<&mut ElemPreferences>

Get the mut preferences element of the selected cashflow.

§Return
  • See description.

pub fn list_event(&self) -> Option<&ListEvent>

Get the event list of the selected cashflow.

§Return
  • See description.

pub fn list_event_mut(&mut self) -> Option<&mut ListEvent>

Get the event list mut of the selected cashflow.

§Return
  • See description.

pub fn list_amortization(&self) -> Option<&ListAmortization>

Get the amortization list of the selected cashflow.

§Return
  • See description.

pub fn calculate(&self) -> &CalcCalculate

Get the calculate object of the selected cashflow.

§Return
  • See description.

pub fn list_statistic_helper(&self) -> Option<&ListStatisticHelper>

Get the statistic helper of the selected cashflow.

§Return
  • See description.

pub fn elem_balance_result(&self) -> Option<&ElemBalanceResult>

Get the last balance result of the selected cashflow.

§Return
  • See description.

pub fn last_amortization_index(&self) -> usize

Get the last amortization index.

§Return
  • See description.

pub fn cashflow_valid(&self) -> bool

Get the cashflow is valid, otherwise it must be re-balanced.

§Return
  • See description.

pub fn updated(&self) -> bool

Get the currently selected cashflow has been updated.

§Return
  • See description.

pub fn get_element_name(&self, index_param: usize) -> &str

Get the name of the cashflow based upon an index value. The currently selected element is not changed.

§Arguments
  • index_param - The index value of the cashflow (starting from 0).
§Return
  • See description.

pub fn get_element_by_name( &self, name_param: &str, is_select_param: bool, ) -> bool

Select a cashflow based upon a cashflow name.

§Arguments
  • name_param - The name of the cashflow to select.
  • is_select_param - If true select element, otherwise restore current element.
§Return
  • True if successful, otherwise false.

pub fn remove(&mut self) -> bool

Remove the selected cashflow from the cashflow list.

§Return
  • True if successful, otherwise false.

pub fn reset_updated(&mut self)

Reset the updated value.

pub fn set_cashflow_valid(&mut self, valid_param: bool) -> bool

Set the cashflow valid.

§Arguments
  • valid_param - See description.

pub fn set_name(&mut self, name_param: &str) -> bool

Set the name of the selected cashflow. Duplicate names are not allowed.

§Arguments
  • name_param - See description.
§Return
  • True if successful, otherwise false.

pub fn set_list_event(&mut self, list_event_param: ListEvent) -> bool

Set the list event.

§Arguments
  • list_event_param - See description.

pub fn set_list_amortization(&mut self, list_am_param: ListAmortization) -> bool

Set the list amortization.

§Arguments
  • list_am_param - See description.

pub fn set_statistic_helper( &mut self, statistic_helper_param: ListStatisticHelper, ) -> bool

Set the statistic helper.

§Arguments
  • statistic_helper_param - See description.

pub fn set_elem_balance_result( &mut self, elem_balance_result_param: ElemBalanceResult, ) -> bool

Set the balance result.

§Arguments
  • elem_balance_result_param - See description.

pub fn set_last_amortization_index( &mut self, last_am_index_param: usize, ) -> bool

Set the last amortization index.

§Arguments
  • last_am_index_param - See description.

pub fn set_updated_value(&mut self, updated_param: bool) -> bool

Set the updated value.

§Arguments
  • updated_param - See description.

pub fn update_preferences(&self) -> bool

Update the “calculate-relative” cashflow preferences for the currently selected cashflow. Called after cash flow preferences are updated.

pub fn sort(&mut self)

Sort the event list.

Trait Implementations§

§

impl ListTrait for ListCashflow

List of currently active cashflows list implementation.

§

fn clear(&mut self)

Clear all cashflows from the cashflow list.

§

fn count(&self) -> usize

Get the count of the cashflow list.

§Return
  • See description.
§

fn index(&self) -> usize

Get the index of the selected cashflow (starting from 0).

§Return
  • See description.
§

fn get_element(&self, index_param: usize) -> bool

Select a cashflow based upon an index value.

§Arguments
  • index_param - The index value of the cashflow to select (starting from 0).
§Return
  • True if successful, otherwise false.
§

fn set_index(&self, index_param: usize) -> bool

Set the list index.

§Arguments
  • index_param - See description.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.