Skip to main content

TimeBlock

Struct TimeBlock 

Source
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

Source

pub fn new(label: impl Into<String>, start: TimeOfDay, end: TimeOfDay) -> Self

A block called label from start to end.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for TimeBlock

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TimeBlock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TimeBlock

Source§

impl PartialEq for TimeBlock

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TimeBlock

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.