pub struct Span { /* private fields */ }Expand description
A window on an axis, in whatever Unit its Track counts.
The axis a Track draws. Offsets rather than instants, because a
description carrying a DateTime would carry a timezone with it and the
vocabulary has no business holding one. The app knows which day or month
this is; the description says how far along it a thing sits.
to is exclusive and may exceed the natural period, which is how a span
running past the end is said without a second date: under
Unit::Minutes, 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.