pub struct Rate(/* private fields */);Expand description
Periodic or continuous interest / return rate as a decimal (e.g. 0.05 = 5%).
Domain depends on constructor: Rate::tvm (≥ -1), Rate::payment (> -1),
Rate::positive (> 0), Rate::finite (any finite).
Implementations§
Source§impl Rate
impl Rate
Sourcepub fn finite(value: f64) -> FinanceResult<Self>
pub fn finite(value: f64) -> FinanceResult<Self>
Any finite rate (no lower bound). Prefer domain-specific constructors for TVM.
Sourcepub fn tvm(value: f64) -> FinanceResult<Self>
pub fn tvm(value: f64) -> FinanceResult<Self>
TVM-compatible rate: finite and ≥ -1.0.
Sourcepub fn payment(value: f64) -> FinanceResult<Self>
pub fn payment(value: f64) -> FinanceResult<Self>
Payment / annuity rate: finite and > -1.0.
Sourcepub fn positive(value: f64) -> FinanceResult<Self>
pub fn positive(value: f64) -> FinanceResult<Self>
Strictly positive finite rate (doubling rules, growth rates).
Trait Implementations§
impl Copy for Rate
Source§impl PartialOrd for Rate
impl PartialOrd for Rate
impl StructuralPartialEq for Rate
Auto Trait Implementations§
impl Freeze for Rate
impl RefUnwindSafe for Rate
impl Send for Rate
impl Sync for Rate
impl Unpin for Rate
impl UnsafeUnpin for Rate
impl UnwindSafe for Rate
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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