iced_wgpu/image/atlas/
layer.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::image::atlas::Allocator;

#[derive(Debug)]
pub enum Layer {
    Empty,
    Busy(Allocator),
    Full,
}

impl Layer {
    pub fn is_empty(&self) -> bool {
        matches!(self, Layer::Empty)
    }

    pub fn allocations(&self) -> usize {
        match self {
            Layer::Empty => 0,
            Layer::Busy(allocator) => allocator.allocations(),
            Layer::Full => 1,
        }
    }
}