pub struct PriceSeries { /* private fields */ }Expand description
A lightweight insertion-ordered price series.
Implementations§
Source§impl PriceSeries
impl PriceSeries
Sourcepub const fn new() -> PriceSeries
pub const fn new() -> PriceSeries
Creates an empty unnamed price series.
Sourcepub const fn named(name: SeriesName) -> PriceSeries
pub const fn named(name: SeriesName) -> PriceSeries
Creates an empty named price series.
Sourcepub fn from_points(points: impl IntoIterator<Item = PricePoint>) -> PriceSeries
pub fn from_points(points: impl IntoIterator<Item = PricePoint>) -> PriceSeries
Creates a series from insertion-ordered points.
Sourcepub const fn name(&self) -> Option<&SeriesName>
pub const fn name(&self) -> Option<&SeriesName>
Returns the optional series name.
Sourcepub fn push(&mut self, point: PricePoint)
pub fn push(&mut self, point: PricePoint)
Appends a point, preserving insertion order.
Sourcepub fn first(&self) -> Option<&PricePoint>
pub fn first(&self) -> Option<&PricePoint>
Returns the first point.
Sourcepub fn last(&self) -> Option<&PricePoint>
pub fn last(&self) -> Option<&PricePoint>
Returns the last point.
Sourcepub fn iter(&self) -> Iter<'_, PricePoint>
pub fn iter(&self) -> Iter<'_, PricePoint>
Iterates over points in insertion order.
Sourcepub fn adjacent_simple_returns(
&self,
) -> Result<Vec<SimpleReturn>, PriceSeriesError>
pub fn adjacent_simple_returns( &self, ) -> Result<Vec<SimpleReturn>, PriceSeriesError>
Computes adjacent simple returns in insertion order.
§Errors
Returns PriceSeriesError::Return when a price pair cannot produce a simple return.
Trait Implementations§
Source§impl Clone for PriceSeries
impl Clone for PriceSeries
Source§fn clone(&self) -> PriceSeries
fn clone(&self) -> PriceSeries
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 moreSource§impl Debug for PriceSeries
impl Debug for PriceSeries
Source§impl Default for PriceSeries
impl Default for PriceSeries
Source§fn default() -> PriceSeries
fn default() -> PriceSeries
Returns the “default value” for a type. Read more
Source§impl<'a> IntoIterator for &'a PriceSeries
impl<'a> IntoIterator for &'a PriceSeries
Source§type Item = &'a PricePoint
type Item = &'a PricePoint
The type of the elements being iterated over.
Source§type IntoIter = Iter<'a, PricePoint>
type IntoIter = Iter<'a, PricePoint>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <&'a PriceSeries as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a PriceSeries as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Source§impl IntoIterator for PriceSeries
impl IntoIterator for PriceSeries
Source§type Item = PricePoint
type Item = PricePoint
The type of the elements being iterated over.
Source§type IntoIter = IntoIter<PricePoint>
type IntoIter = IntoIter<PricePoint>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <PriceSeries as IntoIterator>::IntoIter
fn into_iter(self) -> <PriceSeries as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Source§impl PartialEq for PriceSeries
impl PartialEq for PriceSeries
Source§fn eq(&self, other: &PriceSeries) -> bool
fn eq(&self, other: &PriceSeries) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PriceSeries
Auto Trait Implementations§
impl Freeze for PriceSeries
impl RefUnwindSafe for PriceSeries
impl Send for PriceSeries
impl Sync for PriceSeries
impl Unpin for PriceSeries
impl UnsafeUnpin for PriceSeries
impl UnwindSafe for PriceSeries
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