pub fn sln(
cost: Decimal,
salvage: Decimal,
life: u32,
) -> Vec<DepreciationPeriod>
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 assetsalvage
- The estimated salvage value of the asset at the end of its useful lifelife
- 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;
use rust_decimal_macros::*;
let cost = dec!(10_000);
let salvage = dec!(1_000);
let life = 5;
let schedule = sln(cost, salvage, life);