pub struct TimeBlock { /* private fields */ }Expand description
One block of a Timeline: a stretch of the day with a name, such as work from 09:00 to
11:10.
A block whose end is not after its start runs past midnight into the next day; one whose end is its start is a moment, still drawn one cell wide.
A block that does not really stop where the strip shows it stopping — a session that runs on
past midnight, one carried over from the day before, a counter still running — marks that
edge with open_end or open_start, and a block that
only echoes time recorded elsewhere, such as the next day’s part of that session, is
faint.
Implementations§
Source§impl TimeBlock
impl TimeBlock
Sourcepub fn new(label: impl Into<String>, start: TimeOfDay, end: TimeOfDay) -> Self
pub fn new(label: impl Into<String>, start: TimeOfDay, end: TimeOfDay) -> Self
A block called label from start to end.
Sourcepub fn tone(self, index: usize) -> Self
pub fn tone(self, index: usize) -> Self
Takes the theme’s index-th series tone
(Theme::series_color) instead of the accent, for a
block of one category among several. Give the category the same index in the
Legend beside the timeline, through Legend::tones.
Sourcepub fn open_end(self) -> Self
pub fn open_end(self) -> Self
Leaves the end open: the block goes on after the time it is drawn to, because it runs past the end of the day or because it is still running. Its last cells fade towards the track instead of stopping square, and the readout says which: “continues next day” for a block that reaches the day’s end, “running” for one that stops before it.
Only the block’s own end is drawn open. Where a zoomed range cuts the
block the edge stays square, as the range is where the view stops, not where the block
does. A block too short for a fade keeps its tone, and the readout still says it.
Sourcepub fn open_start(self) -> Self
pub fn open_start(self) -> Self
Leaves the start open: the block began before the time it is drawn from, such as a session
carried over from the previous day. Its first cells fade in from the track, and the readout
says “from the previous day” for a block that starts with the day, “from earlier” for one
that starts later. Drawn like open_end, at the other edge.
Sourcepub fn faint(self) -> Self
pub fn faint(self) -> Self
Draws the block in a quieter tone, halfway between its own and the empty track, for time that belongs to something shown in full elsewhere — the next day’s part of a session that started the night before. It still answers hover and selection, and it keeps its category’s tone family, so it reads as the same thing, fainter.
Trait Implementations§
impl Eq for TimeBlock
impl StructuralPartialEq for TimeBlock
Auto Trait Implementations§
impl Freeze for TimeBlock
impl RefUnwindSafe for TimeBlock
impl Send for TimeBlock
impl Sync for TimeBlock
impl Unpin for TimeBlock
impl UnsafeUnpin for TimeBlock
impl UnwindSafe for TimeBlock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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