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
use device_tree::DeviceTree;

mod compatible;
mod node;

pub use compatible::*;
pub use node::*;

/// Represents a DeviceTree loaded from an FDT description.
pub struct Tree {
    dt: DeviceTree,
}

impl Tree {
    /// Gets a reference to the inner [`DeviceTree`].
    pub const fn device_tree(&self) -> &DeviceTree {
        &self.dt
    }

    /// Gets a mutable reference to the inner [`DeviceTree`].
    pub fn device_tree_mut(&mut self) -> &mut DeviceTree {
        &mut self.dt
    }
}

impl From<DeviceTree> for Tree {
    fn from(val: DeviceTree) -> Self {
        Self { dt: val }
    }
}