pub struct FdtNode {
pub(crate) name: String,
pub(crate) props: IndexMap<String, Vec<u8>>,
pub(crate) subnodes: IndexMap<String, FdtNode>,
}
Expand description
Flattened device tree node.
This represents a single node from the FDT structure block. Every node may contain properties and other (child) nodes.
Fields§
§name: String
Node name
props: IndexMap<String, Vec<u8>>
§subnodes: IndexMap<String, FdtNode>
Implementations§
source§impl FdtNode
impl FdtNode
pub(crate) fn new( name: String, props: IndexMap<String, Vec<u8>>, subnodes: IndexMap<String, FdtNode> ) -> Result<Self>
pub(crate) fn empty(name: impl Into<String>) -> Result<Self>
fn read_token(input: &mut &'_ [u8]) -> Result<u32>
fn parse_node(input: &mut &'_ [u8], strings: &FdtStrings) -> Result<Self>
fn from_blob(input: &'_ [u8], strings: &FdtStrings) -> Result<Self>
fn write_blob( &self, writer: &mut impl Write, strings: &mut FdtStrings ) -> Result<()>
pub(crate) fn prop_names(&self) -> impl Iterator<Item = &str>
pub(crate) fn has_prop(&self, name: &str) -> bool
sourcepub fn get_prop<T>(&self, name: &str) -> Option<T>where
T: FromFdtPropval,
pub fn get_prop<T>(&self, name: &str) -> Option<T>where
T: FromFdtPropval,
pub(crate) fn phandle_at_offset(&self, name: &str, offset: usize) -> Option<u32>
pub(crate) fn update_phandle_at_offset( &mut self, name: &str, offset: usize, phandle: u32 ) -> Result<()>
sourcepub fn set_prop<T>(&mut self, name: &str, value: T) -> Result<()>where
T: ToFdtPropval,
pub fn set_prop<T>(&mut self, name: &str, value: T) -> Result<()>where
T: ToFdtPropval,
Write a property.
§Arguments
name
- name of the property; must be a valid property name according to DT spec.
val
- value of the property (raw byte array).
sourcepub fn subnode(&self, name: &str) -> Option<&FdtNode>
pub fn subnode(&self, name: &str) -> Option<&FdtNode>
Return a reference to an existing subnode with given name, or None
if it doesn’t exist.
§Arguments
name
- name of the node.
sourcepub fn subnode_mut(&mut self, name: &str) -> Result<&mut FdtNode>
pub fn subnode_mut(&mut self, name: &str) -> Result<&mut FdtNode>
Create a node if it doesn’t already exist, and return a mutable reference to it. Return an error if the node name is not valid.
§Arguments
name
- name of the node; must be a valid node name according to DT specification.
pub(crate) fn iter_subnodes(&self) -> impl Iterator<Item = &FdtNode>
pub(crate) fn iter_subnodes_mut(&mut self) -> impl Iterator<Item = &mut FdtNode>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for FdtNode
impl Send for FdtNode
impl Sync for FdtNode
impl Unpin for FdtNode
impl UnwindSafe for FdtNode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more