pub struct TimeframeSelector {
pub current: Timeframe,
pub favorites: HashSet<Timeframe>,
pub custom_timeframes: Vec<Timeframe>,
pub config: TimeframeSelectorConfig,
/* private fields */
}Expand description
Timeframe selector
Fields§
§current: TimeframeCurrently selected timeframe
favorites: HashSet<Timeframe>Favorite timeframes
custom_timeframes: Vec<Timeframe>Custom timeframes
config: TimeframeSelectorConfigConfiguration
Implementations§
Source§impl TimeframeSelector
impl TimeframeSelector
Sourcepub fn new(initial: Timeframe) -> Self
pub fn new(initial: Timeframe) -> Self
Create an interval selector with initial selected and no favorites.
Sourcepub fn set_supported_timeframes(&mut self, timeframes: Option<Vec<Timeframe>>)
pub fn set_supported_timeframes(&mut self, timeframes: Option<Vec<Timeframe>>)
Restrict interval choices to those the connected source can serve, such as the chart
instrument’s supported_timeframes.
None allows every interval; an empty list allows none. Update this when the source or
symbol changes. Saved favourites and custom intervals are retained while unavailable.
Sourcepub fn set_feed_capabilities(&mut self, capabilities: &FeedCapabilities)
pub fn set_feed_capabilities(&mut self, capabilities: &FeedCapabilities)
Restrict interval choices to those the feed serves at all, known before any symbol
resolves: pass Chart::feed_capabilities.
An unreported list allows every interval; an empty one allows none. A symbol’s
set_supported_timeframes narrows this further.
Sourcepub fn preferences(&self) -> TimeframePreferences
pub fn preferences(&self) -> TimeframePreferences
Export the interval lists for the host’s persisted user settings.
Sourcepub fn set_preferences(&mut self, preferences: TimeframePreferences)
pub fn set_preferences(&mut self, preferences: TimeframePreferences)
Restore saved lists, discarding duplicate custom entries.
Sourcepub fn with_config(self, config: TimeframeSelectorConfig) -> Self
pub fn with_config(self, config: TimeframeSelectorConfig) -> Self
Use the supplied display and layout options.
Sourcepub fn show(&mut self, ui: &mut Ui) -> TimeframeAction
pub fn show(&mut self, ui: &mut Ui) -> TimeframeAction
Show favorite interval buttons and the interval menu trigger.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimeframeSelector
impl RefUnwindSafe for TimeframeSelector
impl Send for TimeframeSelector
impl Sync for TimeframeSelector
impl Unpin for TimeframeSelector
impl UnsafeUnpin for TimeframeSelector
impl UnwindSafe for TimeframeSelector
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> 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