pub struct PaintKey { /* private fields */ }Expand description
Where an entry sits in a SceneView’s single paint
order.
| rank | contents |
|---|---|
RANK_UNDER | lightweight items in SceneLayer::Under |
RANK_WIDGET | heavyweight widget entries, and lightweight items in SceneLayer::Interleaved |
RANK_OVER | lightweight items in SceneLayer::Over |
Within a rank, ascending z; ties broken by seq, the entry’s
ItemId — which is a process-monotone counter, so ties
resolve in insertion order. A higher key paints later, is therefore on
top, and therefore wins the pointer.
SceneLayer is not a separate concept any more: it is
the leading digit of this key.
§Why the tie-break is load-bearing
Paint sorts ascending and stably over an id-ordered candidate list, so the
newest of two equal-z items paints last and is on top. The hit snapshots
used to sort descending and stably over that same ascending list, which
leaves equal-z ties in ascending order — so the first match was the
oldest, i.e. the bottom-most, item. Paint and hit were exactly inverted
on ties. Comparing whole keys fixes that by construction: a descending sort
on (rank, z, seq) really does put the topmost entry first.
§NaN
A non-finite z is normalised to 0.0 at construction, so the ordering is
total and sort_by is not order-dependent. The old sites compared with
partial_cmp(..).unwrap_or(Equal), which is not a total order.
Implementations§
Source§impl PaintKey
impl PaintKey
Sourcepub fn new(rank: u8, z: f32, seq: u64) -> Self
pub fn new(rank: u8, z: f32, seq: u64) -> Self
Build a key. z is normalised (NaN → 0.0) so the ordering is total.
Sourcepub const fn rank(self) -> u8
pub const fn rank(self) -> u8
The tier / band digit — one of RANK_UNDER, RANK_WIDGET,
RANK_OVER.
Sourcepub const fn seq(self) -> u64
pub const fn seq(self) -> u64
The insertion tie-break — the entry’s ItemId as a
number.
Stable only as long as the id is. A
SceneListAdapter re-mints ids on a
structural DataChange, so equal-z ordering inside an adapter-owned
run does shuffle on an append. That is a property of the adapter, not a
guarantee this key makes.
Sourcepub const fn is_above_widgets(self) -> bool
pub const fn is_above_widgets(self) -> bool
True when this key can never lose to a heavyweight entry.
Sourcepub const fn bottom() -> Self
pub const fn bottom() -> Self
A floor below every real key — “admit everything”.
z is -inf rather than a finite sentinel so that a real entry sitting
at f32::MIN is still admitted, and Ord compares z with
total_cmp, under which -inf is below every finite value.
Sourcepub const fn rank_floor(rank: u8) -> Self
pub const fn rank_floor(rank: u8) -> Self
A floor admitting exactly the entries at rank and above.
The coarse form of a floor, and the one the dispatch path uses: “a card
won the arena’s walk, so only the band that outranks every card may
still take this event”. The fine form — one specific entry’s key — is
what the accepts_child_hit veto needs, because an
Interleaved entry is above some
cards and below others.
Trait Implementations§
impl Copy for PaintKey
impl Eq for PaintKey
Source§impl Ord for PaintKey
impl Ord for PaintKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for PaintKey
impl PartialOrd for PaintKey
impl StructuralPartialEq for PaintKey
Auto Trait Implementations§
impl Freeze for PaintKey
impl RefUnwindSafe for PaintKey
impl Send for PaintKey
impl Sync for PaintKey
impl Unpin for PaintKey
impl UnsafeUnpin for PaintKey
impl UnwindSafe for PaintKey
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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