Function sln

Source
pub fn sln<T: FloatLike>(
    cost: T,
    salvage: T,
    life: u32,
) -> Vec<DepreciationPeriod<T>>
Expand description

Straight Line Depreciation (SLN)

Calculates the depreciation schedule for an asset using the straight-line method.

§Feature

This function requires the std feature to be enabled as it uses the std::Vec. sln_into can be used in a no_std environment as any allocation is done by the caller.

§Arguments

  • cost - The initial cost of the asset
  • salvage - The estimated salvage value of the asset at the end of its useful life
  • life - The number of periods over which the asset will be depreciated

§Returns

  • A vector of DepreciationPeriod instances representing each period in the depreciation schedule.

§Examples

  • $10,000 asset, $1,000 salvage value, 5 year life
use rust_finprim::amort_dep_tax::sln;

let cost = 10_000.0;
let salvage = 1_000.0;
let life = 5;
let schedule = sln(cost, salvage, life);