pub struct TimeframeVisibility {
pub show_on_all: bool,
pub visible_timeframes: HashSet<String>,
pub ranges: BTreeMap<TimeframeUnit, RangeInclusive<u64>>,
}Expand description
The intervals a drawing shows on.
While show_on_all is set, a drawing shows on every interval. Otherwise it
shows on the intervals named in visible_timeframes and on those
whose unit has a range in ranges holding their value. An interval’s unit and
value are those of its label, as Timeframe::as_str writes
it: 90min is 90 minutes, and a 24 hour interval, labelled 1D, is 1 day.
Fields§
§show_on_all: boolShow on every interval.
visible_timeframes: HashSet<String>Interval labels the drawing shows on, matched exactly.
ranges: BTreeMap<TimeframeUnit, RangeInclusive<u64>>Values of each unit the drawing shows on, both ends included, such as 1 to 4 hours for 1h, 2h, 3h and 4h. A range whose start is after its end holds no value.
Implementations§
Source§impl TimeframeVisibility
impl TimeframeVisibility
Sourcepub fn is_visible_on(&self, timeframe: &str) -> bool
pub fn is_visible_on(&self, timeframe: &str) -> bool
Check if visible on the interval labelled timeframe
Sourcepub fn range(&self, unit: TimeframeUnit) -> Option<RangeInclusive<u64>>
pub fn range(&self, unit: TimeframeUnit) -> Option<RangeInclusive<u64>>
The values of unit the drawing shows on: its range, widened to cover the labels of that
unit in visible_timeframes. None when neither names the unit.
Sourcepub fn set_range(
&mut self,
unit: TimeframeUnit,
range: Option<RangeInclusive<u64>>,
)
pub fn set_range( &mut self, unit: TimeframeUnit, range: Option<RangeInclusive<u64>>, )
Show the drawing on range of unit, or on no interval of that unit for None, in place
of that unit’s labels in visible_timeframes. A range turns
show_on_all off.
Sourcepub fn add_timeframe(&mut self, timeframe: &str)
pub fn add_timeframe(&mut self, timeframe: &str)
Add a timeframe to visibility
Sourcepub fn remove_timeframe(&mut self, timeframe: &str)
pub fn remove_timeframe(&mut self, timeframe: &str)
Remove a timeframe from visibility
Trait Implementations§
Source§impl Clone for TimeframeVisibility
impl Clone for TimeframeVisibility
Source§fn clone(&self) -> TimeframeVisibility
fn clone(&self) -> TimeframeVisibility
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 TimeframeVisibility
impl Debug for TimeframeVisibility
Source§impl Default for TimeframeVisibility
impl Default for TimeframeVisibility
Source§fn default() -> TimeframeVisibility
fn default() -> TimeframeVisibility
Source§impl<'de> Deserialize<'de> for TimeframeVisibility
impl<'de> Deserialize<'de> for TimeframeVisibility
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for TimeframeVisibility
impl PartialEq for TimeframeVisibility
Source§impl Serialize for TimeframeVisibility
impl Serialize for TimeframeVisibility
impl StructuralPartialEq for TimeframeVisibility
Auto Trait Implementations§
impl Freeze for TimeframeVisibility
impl RefUnwindSafe for TimeframeVisibility
impl Send for TimeframeVisibility
impl Sync for TimeframeVisibility
impl Unpin for TimeframeVisibility
impl UnsafeUnpin for TimeframeVisibility
impl UnwindSafe for TimeframeVisibility
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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