pub struct PeriodLength(/* private fields */);Expand description
Positive lookback / window length for technical indicators (usize ≥ 1).
Distinct from Periods (u32 TVM counts) so TA windows do not silently mix with NPER.
Implementations§
Source§impl PeriodLength
impl PeriodLength
Sourcepub fn new(n: usize) -> FinanceResult<Self>
pub fn new(n: usize) -> FinanceResult<Self>
Fallible constructor: n >= 1.
Sourcepub const fn new_const(n: usize) -> Self
pub const fn new_const(n: usize) -> Self
const constructor for known-valid compile-time windows (e.g. 20 for SMA-20).
Panics in debug if n == 0; release builds still store 0 — prefer PeriodLength::new
for runtime input. For const presets, only pass literals ≥ 1.
pub const fn get(self) -> usize
Trait Implementations§
Source§impl Clone for PeriodLength
impl Clone for PeriodLength
Source§fn clone(&self) -> PeriodLength
fn clone(&self) -> PeriodLength
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PeriodLength
Source§impl Debug for PeriodLength
impl Debug for PeriodLength
Source§impl Display for PeriodLength
impl Display for PeriodLength
impl Eq for PeriodLength
Source§impl From<PeriodLength> for usize
impl From<PeriodLength> for usize
Source§fn from(p: PeriodLength) -> usize
fn from(p: PeriodLength) -> usize
Converts to this type from the input type.
Source§impl Hash for PeriodLength
impl Hash for PeriodLength
Source§impl Ord for PeriodLength
impl Ord for PeriodLength
Source§fn cmp(&self, other: &PeriodLength) -> Ordering
fn cmp(&self, other: &PeriodLength) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PeriodLength
impl PartialEq for PeriodLength
Source§impl PartialOrd for PeriodLength
impl PartialOrd for PeriodLength
impl StructuralPartialEq for PeriodLength
Auto Trait Implementations§
impl Freeze for PeriodLength
impl RefUnwindSafe for PeriodLength
impl Send for PeriodLength
impl Sync for PeriodLength
impl Unpin for PeriodLength
impl UnsafeUnpin for PeriodLength
impl UnwindSafe for PeriodLength
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