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.

§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;
use rust_decimal_macros::*;

let cost = dec!(10_000);
let salvage = dec!(1_000);
let life = 5;
let schedule = sln(cost, salvage, life);