Skip to main content

GridCompositor

Struct GridCompositor 

Source
pub struct GridCompositor { /* private fields */ }
Expand description

Grid compositor managing block ownership.

The compositor ensures:

  • No two blocks claim the same cell
  • Blocks are rendered in z-order
  • Dirty regions are tracked for efficient redraw

Implementations§

Source§

impl GridCompositor

Source

pub fn new(template: GridTemplate) -> Self

Create a new compositor with the given template.

Source

pub fn template(&self) -> &GridTemplate

Get the grid template.

Source

pub fn register( &mut self, block: ComputeBlock, ) -> Result<usize, CompositorError>

Register a block, claiming grid cells.

Returns the block index on success, or an error if:

  • The block area is out of grid bounds
  • The block overlaps with an existing block
Source

pub fn unregister( &mut self, name: &str, ) -> Result<ComputeBlock, CompositorError>

Unregister a block by name, freeing its cells.

Source

pub fn get(&self, name: &str) -> Option<&ComputeBlock>

Get a block by name.

Source

pub fn get_mut(&mut self, name: &str) -> Option<&mut ComputeBlock>

Get a mutable block by name.

Source

pub fn bounds(&self, name: &str, total_area: Rect) -> Option<Rect>

Get computed bounds for a block.

Source

pub fn blocks(&self) -> &[ComputeBlock]

Get all registered blocks.

Source

pub fn mark_dirty(&mut self, rect: Rect)

Mark a region as dirty (needs redraw).

Source

pub fn take_dirty(&mut self) -> Vec<Rect>

Clear dirty rectangles and return them.

Source

pub fn is_dirty(&self) -> bool

Check if any regions are dirty.

Source

pub fn render_order(&self) -> Vec<&ComputeBlock>

Get blocks sorted by z-index for rendering.

Source

pub fn owner_at(&self, row: usize, col: usize) -> Option<&ComputeBlock>

Get the block that owns a specific cell.

Trait Implementations§

Source§

impl Clone for GridCompositor

Source§

fn clone(&self) -> GridCompositor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GridCompositor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.