Skip to main content

TimeframeSelector

Struct TimeframeSelector 

Source
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: Timeframe

Currently selected timeframe

§favorites: HashSet<Timeframe>

Favorite timeframes

§custom_timeframes: Vec<Timeframe>

Custom timeframes

§config: TimeframeSelectorConfig

Configuration

Implementations§

Source§

impl TimeframeSelector

Source

pub fn new(initial: Timeframe) -> Self

Create an interval selector with initial selected and no favorites.

Source

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.

Source

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.

Source

pub fn preferences(&self) -> TimeframePreferences

Export the interval lists for the host’s persisted user settings.

Source

pub fn set_preferences(&mut self, preferences: TimeframePreferences)

Restore saved lists, discarding duplicate custom entries.

Source

pub fn with_config(self, config: TimeframeSelectorConfig) -> Self

Use the supplied display and layout options.

Source

pub fn show(&mut self, ui: &mut Ui) -> TimeframeAction

Show favorite interval buttons and the interval menu trigger.

Trait Implementations§

Source§

impl Default for TimeframeSelector

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> MaybeSend for T
where T: Send + Sync + ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.