1use crate::{Integer, Rect};
7
8pub trait Center<T = Self> {
10 fn center(&self) -> T;
12}
13
14pub trait DistributeGrid<T = Self> {
16 fn distribute_grid(&self, rect: Rect, rows: Integer, columns: Integer) -> T;
18}
19
20pub trait TotalMemory {
22 fn total_memory(&self) -> usize {
24 self.stack_memory() + self.heap_memory()
25 }
26
27 fn stack_memory(&self) -> usize {
29 std::mem::size_of_val(self)
30 }
31
32 fn heap_memory(&self) -> usize {
34 0
35 }
36}
37
38impl<T> TotalMemory for Vec<T> {
39 fn heap_memory(&self) -> usize {
40 self.capacity() * std::mem::size_of::<T>()
41 }
42}
43
44pub trait VertexCount {
46 fn vertex_count(&self) -> usize;
48}