Struct Fdt

Source
pub struct Fdt { /* private fields */ }
Expand description

§Fdt

A wrapper for an FDT binary. This is the first object to instantiate to manipulate FDT binaries.

Implementations§

Source§

impl Fdt

Source

pub fn new(fdt: Box<[u8]>) -> Result<Fdt, Error>

Create a new Fdt from its binary representation. The binary is not copied.

Source

pub fn path_offset(&self, path: &str) -> Result<Offset, Error>

Get the offset of a node, given its path.

Source

pub fn first_property_offset(&self, nodeoffset: Offset) -> Result<Offset, Error>

Get the first property of a node, given its offset.

This is mostly useful to iterate over the properties of a node. Please check FdtNode::properties_iter and the documentation of crate::FdtPropertyIter if you are looking for a property iterator.

Source

pub fn first_property<'fdt>( &'fdt self, node: &FdtNode<'fdt>, ) -> Result<Option<FdtProperty<'fdt>>, Error>

Get the first property of an FdtNode.

This is mostly useful to iterate over the properties of a node. Please check FdtNode::properties_iter and the documentation of crate::FdtPropertyIter if you are looking for a property iterator.

Source

pub fn next_property_offset(&self, offset: Offset) -> Result<Offset, Error>

Get the next property of a node, given its offset.

This is mostly useful to iterate over the properties of a node. Please check FdtNode::properties_iter and the documentation of crate::FdtPropertyIter if you are looking for a property iterator.

Source

pub fn next_property<'fdt>( &'fdt self, property: &FdtProperty<'fdt>, ) -> Result<Option<FdtProperty<'fdt>>, Error>

Get the next property of an FdtNode.

This is mostly useful to iterate over the properties of a node. Please check FdtNode::properties_iter and the documentation of crate::FdtPropertyIter if you are looking for a property iterator.

Source

pub fn first_subnode_offset(&self, offset: Offset) -> Result<Offset, Error>

Get the first subnode of a node, given its offset.

This is mostly useful to iterate over the subnodes of a node. Please check FdtNode::subnodes_iter and the documentation of crate::FdtNodeIter if you are looking for a subnode iterator.

Source

pub fn first_subnode<'fdt>( &'fdt self, parent_node: &FdtNode<'fdt>, ) -> Result<Option<FdtNode<'fdt>>, Error>

Get the first subnode of a FdtNode.

This is mostly useful to iterate over the subnodes of a node. Please check FdtNode::subnodes_iter and the documentation of crate::FdtNodeIter if you are looking for a subnode iterator.

Source

pub fn next_subnode_offset(&self, offset: Offset) -> Result<Offset, Error>

Get the next subnode of a node, given its offset.

This is mostly useful to iterate over the subnodes of a node. Please check FdtNode::subnodes_iter and the documentation of crate::FdtNodeIter if you are looking for a subnode iterator.

Source

pub fn next_subnode<'fdt>( &'fdt self, previous_node: &FdtNode<'fdt>, ) -> Result<Option<FdtNode<'fdt>>, Error>

Get the next subnode of a FdtNode.

This is mostly useful to iterate over the subnodes of a node. Please check FdtNode::subnodes_iter and the documentation of crate::FdtNodeIter if you are looking for a subnode iterator.

Source

pub fn get_node_by_offset<'fdt>( &'fdt self, nodeoffset: Offset, ) -> Result<FdtNode<'fdt>, Error>

Get an FdtNode from its offset in the Fdt

Source

pub fn get_property_by_offset<'fdt>( &'fdt self, offset: Offset, ) -> Result<FdtProperty<'fdt>, Error>

Get an FdtProperty from its offset in the Fdt

Source

pub fn get_property<'fdt>( &'fdt self, node: &FdtNode<'fdt>, property_name: &str, ) -> Result<FdtProperty<'fdt>, Error>

Get an FdtProperty given its parent node and its name.

Source

pub fn get_phandle<'fdt>( &'fdt self, node: &FdtNode<'fdt>, ) -> Result<Phandle, Error>

Get the phandle of a given FdtNode.

Returns Error::BadPhandle if not phandle property is attached to the input node

Source

pub fn is_compatible<'fdt>( &'fdt self, node: &FdtNode<'fdt>, compatible: &str, ) -> Result<bool, Error>

Determines if the input compatible string matches with the ‘compatible’ property of a given node.

Returns Error::NotFound if not compatible property is attached to the input node

Source

pub fn get_node<'fdt>(&'fdt self, path: &str) -> Result<FdtNode<'fdt>, Error>

Get the FdtNode associated with the input path.

Source

pub fn get_node_by_phandle<'fdt>( &'fdt self, phandle: &Phandle, ) -> Result<FdtNode<'fdt>, Error>

Get the FdtNode associated with the given phandle.

Source

pub fn as_path<'fdt>( &'fdt self, node_ref: &'fdt FdtNodeRef, ) -> Result<&'fdt str, Error>

Get the full path of an FdtNodeRef.

It is particularly useful for parsing symbol tables in the Fdt.

Source

pub fn symbol_table(&self) -> Result<HashMap<String, String>, Error>

Get the symbol table of the Fdt as a HashMap, where the symbols are the keys and the associated (full) paths are the values.

Trait Implementations§

Source§

impl Debug for Fdt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Fdt

§

impl RefUnwindSafe for Fdt

§

impl !Send for Fdt

§

impl !Sync for Fdt

§

impl Unpin for Fdt

§

impl UnwindSafe for Fdt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.