pub struct Span { /* private fields */ }Expand description
A window of time, in minutes from the start of a day.
The axis a Track draws. Minutes rather than instants, and offsets rather
than wall-clock, because a description that carried a DateTime would carry
a timezone with it and the vocabulary has no business holding one. The app
knows which day this is; the description says how far along it a thing sits.
to is exclusive and may exceed 1440, which is how a span that runs past
midnight is said without a second date: Span::new(1320, 1560) is 22:00 to
02:00.
Implementations§
Source§impl Span
impl Span
Sourcepub const fn new(from: u16, to: u16) -> Self
pub const fn new(from: u16, to: u16) -> Self
A span, clamped to a sane one.
An empty or backwards span is a caller bug that should not cost a
renderer a division by zero, so to is forced at least one minute past
from rather than returning an error nobody can act on. Same reasoning
as Share::percent, which clamps rather than refuses.