1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use std::ops::{
    Deref,
    DerefMut,
};

use freya_native_core::NodeId;
use rustc_hash::FxHashSet;

#[derive(Clone, Default, Debug)]
pub struct CompositorDirtyNodes(FxHashSet<NodeId>);

impl Deref for CompositorDirtyNodes {
    type Target = FxHashSet<NodeId>;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl DerefMut for CompositorDirtyNodes {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}

impl CompositorDirtyNodes {
    /// Mark a certain node as invalidated.
    pub fn invalidate(&mut self, node_id: NodeId) {
        self.0.insert(node_id);
    }
}