pub struct DepthHistory { /* private fields */ }Expand description
Columns of the order book of one chart, oldest first. Turn it on with
Chart::set_depth_history and read it with Chart::depth_history.
use egui_charts::data::{DepthHistory, DepthHistoryConfig};
let config = DepthHistoryConfig { ticks_per_row: 4, ..Default::default() };
let history = DepthHistory::new(config).unwrap();
assert_eq!(history.columns().count(), 0);Implementations§
Source§impl DepthHistory
impl DepthHistory
Sourcepub fn new(config: DepthHistoryConfig) -> Result<Self, FeedError>
pub fn new(config: DepthHistoryConfig) -> Result<Self, FeedError>
An empty history, or an error if config breaks one of its limits.
Sourcepub fn config(&self) -> &DepthHistoryConfig
pub fn config(&self) -> &DepthHistoryConfig
The configuration the history samples with.
Sourcepub fn columns(&self) -> impl DoubleEndedIterator<Item = &DepthColumn>
pub fn columns(&self) -> impl DoubleEndedIterator<Item = &DepthColumn>
Every column, oldest first. Consecutive columns are adjacent unless the chart lost columns.
Sourcepub fn merge_page(&mut self, page: Vec<DepthColumn>) -> Result<usize, FeedError>
pub fn merge_page(&mut self, page: Vec<DepthColumn>) -> Result<usize, FeedError>
Merges a historical page, preserving every held column on overlap and keeping time gaps.
Older columns merge to the oldest tier’s resolution, and columns that fill a gap to the
resolution of the tier they join; either completes a short held column right after it.
Full columns merge only when their tier overflows.
Columns must use this history’s grid and sorted, unique rows, with finite non-negative
sizes and at most config.rows per side. Invalid pages leave the history unchanged.
A side’s largest orders, if it has any, are one per row, finite and not negative.
Memory remains bounded by the configured tiers. Returns the number of input columns
retained, including those merged to a coarser resolution. Columns beyond the oldest
tier’s capacity are dropped and do not count.
Trait Implementations§
Source§impl Clone for DepthHistory
impl Clone for DepthHistory
Source§fn clone(&self) -> DepthHistory
fn clone(&self) -> DepthHistory
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DepthHistory
impl RefUnwindSafe for DepthHistory
impl Send for DepthHistory
impl Sync for DepthHistory
impl Unpin for DepthHistory
impl UnsafeUnpin for DepthHistory
impl UnwindSafe for DepthHistory
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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