pub struct LayerId(pub u64);Expand description
Stable identity for a layer across frames.
§Deviation: identity by value, not by address
The C++ allocator remembers const Layer* and therefore needs
forget_layer(), which the header explains must run before a Layer is
destroyed:
without invalidation, heap reuse can give a freshly-added layer the same address, fool the diff path into treating the two as the same logical layer, and silently skip property writes the kernel needs.
Keying on a caller-assigned id removes that hazard rather than mitigating
it: a recycled allocation cannot masquerade as a previous layer, provided
the caller never reuses an id (Output and the scene
never do). Allocator::forget_layer is still worth calling, to keep the
fast path warm and to force a full write on the plane the layer leaves.
Tuple Fields§
§0: u64Trait Implementations§
impl Copy for LayerId
impl Eq for LayerId
Source§impl Ord for LayerId
impl Ord for LayerId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for LayerId
impl PartialOrd for LayerId
impl StructuralPartialEq for LayerId
Auto Trait Implementations§
impl Freeze for LayerId
impl RefUnwindSafe for LayerId
impl Send for LayerId
impl Sync for LayerId
impl Unpin for LayerId
impl UnsafeUnpin for LayerId
impl UnwindSafe for LayerId
Blanket Implementations§
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
Mutably borrows from an owned value. Read more