pub struct ReplayState {Show 13 fields
pub playback_state: PlaybackState,
pub speed: ReplaySpeed,
pub curr_bar: usize,
pub total_bars: usize,
pub visible_bars: usize,
pub start_date: Option<DateTime<Utc>>,
pub end_date: Option<DateTime<Utc>>,
pub curr_date: Option<DateTime<Utc>>,
pub symbol: Option<String>,
pub speed_dropdown_open: bool,
pub date_picker_open: bool,
pub settings_open: bool,
pub markers: Vec<ReplayMarker>,
/* private fields */
}Expand description
Main replay state
Fields§
§playback_state: PlaybackStateCurrent playback state
speed: ReplaySpeedCurrent playback speed
curr_bar: usizeCurrent bar index (0-based)
total_bars: usizeTotal number of bars available
visible_bars: usizeVisible bar count (how many bars to show on chart)
start_date: Option<DateTime<Utc>>Start date of replay data
end_date: Option<DateTime<Utc>>End date of replay data
curr_date: Option<DateTime<Utc>>Current date/time at playback position
symbol: Option<String>Symbol being replayed
speed_dropdown_open: boolWhether speed dropdown is open
date_picker_open: boolWhether date picker is open
settings_open: boolWhether settings panel is open
markers: Vec<ReplayMarker>User-placed markers
Implementations§
Source§impl ReplayState
impl ReplayState
Sourcepub fn init(
&mut self,
total_bars: usize,
start_date: DateTime<Utc>,
end_date: DateTime<Utc>,
symbol: String,
)
pub fn init( &mut self, total_bars: usize, start_date: DateTime<Utc>, end_date: DateTime<Utc>, symbol: String, )
Initialize replay with data params
Sourcepub fn set_bar_duration(&mut self, seconds: f64)
pub fn set_bar_duration(&mut self, seconds: f64)
Set the bar duration (time between bars at 1x speed)
Sourcepub fn is_playing(&self) -> bool
pub fn is_playing(&self) -> bool
Check if currently playing
Sourcepub fn remaining_bars(&self) -> usize
pub fn remaining_bars(&self) -> usize
Get remaining bars
Sourcepub fn toggle_play_pause(&mut self)
pub fn toggle_play_pause(&mut self)
Toggle play/pause
Sourcepub fn enter_replay_mode(&mut self)
pub fn enter_replay_mode(&mut self)
Enter replay mode
Sourcepub fn exit_replay_mode(&mut self)
pub fn exit_replay_mode(&mut self)
Exit replay mode
Sourcepub fn step_forward(&mut self)
pub fn step_forward(&mut self)
Step forward one bar
Sourcepub fn step_backward(&mut self)
pub fn step_backward(&mut self)
Step backward one bar
Sourcepub fn jump_to_bar(&mut self, bar: usize)
pub fn jump_to_bar(&mut self, bar: usize)
Jump to specific bar
Sourcepub fn jump_to_percent(&mut self, percent: f32)
pub fn jump_to_percent(&mut self, percent: f32)
Jump to percentage position
Sourcepub fn set_speed(&mut self, speed: ReplaySpeed)
pub fn set_speed(&mut self, speed: ReplaySpeed)
Set playback speed
Sourcepub fn add_marker(&mut self, label: Option<String>, color: Option<[u8; 4]>)
pub fn add_marker(&mut self, label: Option<String>, color: Option<[u8; 4]>)
Add a marker at current position
Sourcepub fn remove_marker(&mut self, bar_idx: usize)
pub fn remove_marker(&mut self, bar_idx: usize)
Remove marker at bar index
Sourcepub fn clear_markers(&mut self)
pub fn clear_markers(&mut self)
Clear all markers
Sourcepub fn visible_markers(
&self,
start_bar: usize,
end_bar: usize,
) -> Vec<&ReplayMarker>
pub fn visible_markers( &self, start_bar: usize, end_bar: usize, ) -> Vec<&ReplayMarker>
Get markers in visible range
Sourcepub fn update(&mut self) -> usize
pub fn update(&mut self) -> usize
Update playback state. Call this each frame. Returns the number of bars actually advanced (usually 0 or 1).
Sourcepub fn update_curr_date(&mut self, bar_ts: &[DateTime<Utc>])
pub fn update_curr_date(&mut self, bar_ts: &[DateTime<Utc>])
Update current date based on bar index
Trait Implementations§
Source§impl Clone for ReplayState
impl Clone for ReplayState
Source§fn clone(&self) -> ReplayState
fn clone(&self) -> ReplayState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ReplayState
impl Debug for ReplayState
Auto Trait Implementations§
impl Freeze for ReplayState
impl RefUnwindSafe for ReplayState
impl Send for ReplayState
impl Sync for ReplayState
impl Unpin for ReplayState
impl UnsafeUnpin for ReplayState
impl UnwindSafe for ReplayState
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