pub struct Node {
pub name: String,
/* private fields */
}Expand description
A mutable device tree node.
Represents a node in the device tree with a name, properties, and child node IDs.
Nodes are stored in a flat BTreeMap<NodeId, Node> within the Fdt struct,
and children are referenced by their NodeId.
Fields§
§name: StringNode name (without path)
Implementations§
Source§impl Node
impl Node
Sourcepub fn properties(&self) -> &[Property]
pub fn properties(&self) -> &[Property]
Returns an iterator over the node’s properties.
Sourcepub fn add_child(&mut self, name: &str, id: NodeId)
pub fn add_child(&mut self, name: &str, id: NodeId)
Adds a child node ID to this node.
Updates the name cache for fast lookups.
Sourcepub fn add_property(&mut self, prop: Property)
pub fn add_property(&mut self, prop: Property)
Adds a property to this node.
Updates the property cache for fast lookups.
Sourcepub fn get_child(&self, name: &str) -> Option<NodeId>
pub fn get_child(&self, name: &str) -> Option<NodeId>
Gets a child node ID by name.
Uses the cache for fast lookup.
Sourcepub fn remove_child(&mut self, name: &str) -> Option<NodeId>
pub fn remove_child(&mut self, name: &str) -> Option<NodeId>
Removes a child node by name, returning its NodeId.
Rebuilds the name cache after removal.
Sourcepub fn set_property(&mut self, prop: Property)
pub fn set_property(&mut self, prop: Property)
Sets a property, adding it if it doesn’t exist or updating if it does.
Sourcepub fn get_property(&self, name: &str) -> Option<&Property>
pub fn get_property(&self, name: &str) -> Option<&Property>
Gets a property by name.
Sourcepub fn get_property_mut(&mut self, name: &str) -> Option<&mut Property>
pub fn get_property_mut(&mut self, name: &str) -> Option<&mut Property>
Gets a mutable reference to a property by name.
Sourcepub fn remove_property(&mut self, name: &str) -> Option<Property>
pub fn remove_property(&mut self, name: &str) -> Option<Property>
Removes a property by name.
Updates indices after removal to keep the cache consistent.
Sourcepub fn address_cells(&self) -> Option<u32>
pub fn address_cells(&self) -> Option<u32>
Returns the #address-cells property value.
Sourcepub fn size_cells(&self) -> Option<u32>
pub fn size_cells(&self) -> Option<u32>
Returns the #size-cells property value.
Sourcepub fn interrupt_parent(&self) -> Option<Phandle>
pub fn interrupt_parent(&self) -> Option<Phandle>
Returns the local interrupt-parent property value.
Sourcepub fn ranges(&self, parent_address_cells: u32) -> Option<Vec<RangesEntry>>
pub fn ranges(&self, parent_address_cells: u32) -> Option<Vec<RangesEntry>>
Parses the ranges property for address translation.
Returns a vector of range entries mapping child bus addresses to parent bus addresses.
Sourcepub fn compatible(&self) -> Option<impl Iterator<Item = &str>>
pub fn compatible(&self) -> Option<impl Iterator<Item = &str>>
Returns the compatible property as a string iterator.
Sourcepub fn compatibles(&self) -> impl Iterator<Item = &str>
pub fn compatibles(&self) -> impl Iterator<Item = &str>
Returns an iterator over all compatible strings.
Sourcepub fn device_type(&self) -> Option<&str>
pub fn device_type(&self) -> Option<&str>
Returns the device_type property value.
Sourcepub fn is_interrupt_controller(&self) -> bool
pub fn is_interrupt_controller(&self) -> bool
Returns true if this node is an interrupt controller.
Sourcepub fn interrupt_cells(&self) -> Option<u32>
pub fn interrupt_cells(&self) -> Option<u32>
Returns the #interrupt-cells property value.