pub struct RectSet<const N: usize = DEFAULT_SET_CAPACITY> {
rects: [Rect; N],
len: usize,
}Expand description
A fixed-capacity set of non-overlapping dirty rectangles.
Replacement for both DirtyRectSet and Damage. The rules are:
- overlapping or edge-adjacent rectangles are merged, transitively;
- when the set is full, the new rectangle is merged into the existing one whose union grows the least, so a single far-away rect cannot drag the presented area to the corner of the screen;
- insertion never allocates and never fails.
Fields§
§rects: [Rect; N]§len: usizeImplementations§
Source§impl<const N: usize> RectSet<N>
impl<const N: usize> RectSet<N>
pub const fn empty() -> Self
Sourcepub fn include_set<const M: usize>(&mut self, other: &RectSet<M>)
pub fn include_set<const M: usize>(&mut self, other: &RectSet<M>)
Insert every rectangle of another set.
The capacities may differ: this keeps callers such as the kernel
Presenter from silently depending on two constants staying equal.
pub fn clear(&mut self)
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn capacity(&self) -> usize
pub fn iter(&self) -> RectSetIter<'_, N> ⓘ
Sourcepub fn bounds(&self) -> Rect
pub fn bounds(&self) -> Rect
Bounding box of every rectangle, or Rect::EMPTY.
Sourcepub fn total_area(&self) -> u64
pub fn total_area(&self) -> u64
Sum of the areas. Adjacent rects are merged, so this does not double-count the common case.
Trait Implementations§
impl<const N: usize> Copy for RectSet<N>
Source§impl<const N: usize> IntoIterator for RectSet<N>
impl<const N: usize> IntoIterator for RectSet<N>
Source§impl<'a, const N: usize> IntoIterator for &'a RectSet<N>
impl<'a, const N: usize> IntoIterator for &'a RectSet<N>
Auto Trait Implementations§
impl<const N: usize> Forget for RectSet<N>
impl<const N: usize> Freeze for RectSet<N>
impl<const N: usize> Move for RectSet<N>
impl<const N: usize> RefUnwindSafe for RectSet<N>
impl<const N: usize> Send for RectSet<N>
impl<const N: usize> Sync for RectSet<N>
impl<const N: usize> Unpin for RectSet<N>
impl<const N: usize> UnsafeUnpin for RectSet<N>
impl<const N: usize> UnwindSafe for RectSet<N>
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