pub struct Placement { /* private fields */ }Expand description
Where a thing sits on a Track, and for how long.
The one fact a list cannot carry and the whole reason this primitive exists. A list says what order things come in; a track says a thing starts 135 minutes along and lasts 45, which is a different claim and not derivable from the first.
Implementations§
Source§impl Placement
impl Placement
Sourcepub const fn new(at: u16, minutes: u16) -> Self
pub const fn new(at: u16, minutes: u16) -> Self
A placement, clamped to a drawable one.
Zero minutes becomes one for the same reason Span::new clamps: a
zero-height thing is invisible rather than expressive, and every
renderer would need its own guard.
Sourcepub const fn overlaps(self, other: Self) -> bool
pub const fn overlaps(self, other: Self) -> bool
Whether two placements cover any of the same time.
Geometry, and deliberately not a described field. Whether an overlap is
a conflict is the app’s judgment – a meeting inside a block of free
time overlaps and is fine – and that judgment travels the way every
other judgment does, as a Tone on the thing itself. What a renderer
needs in order to lay two things side by side instead of on top of each
other is this, and it can compute it.
The alternative was a conflicts: bool on each entry, which is state
that can disagree with the times beside it. Two sources for one fact is
how a screen starts rendering a conflict badge on a thing that no longer
conflicts.