Struct Tree

Source
pub struct Tree<'a> { /* private fields */ }
Expand description

Represents a full flattened device tree blob (DTB).

Implementations§

Source§

impl<'a> Tree<'a>

Source

pub unsafe fn from_ptr<E: ParseError<&'a [u8]>>( ptr: *const u8, ) -> Result<Self, Err<E>>

Parse a devicetree blob that begins at the specified memory address.

§Safety

The pointer must hold the address of the first byte of a valid devicetree blob, and it must uphold all the invariants of core::slice::from_raw_parts for a slice beginning at the specified address and extending the total length of the DTB as given in its header.

§Errors

If the header does not have the correct magic number, or any other properties of the header are invalid, this function will return an error.

Source

pub fn from_buffer<E: ParseError<&'a [u8]>>( data: &'a [u8], ) -> Result<Self, Err<E>>

Parse a devicetree blob that starts at the beginning of the slice and extends no further than its end.

§Errors

If the header does not have the correct magic number, or any other properties of the header are invalid, this function will return an error.

Source

pub fn memory_reservation_iter<E: ParseError<&'a [u8]> + 'a>( self: &'a Tree<'a>, ) -> impl Iterator<Item = Result<MemoryReservation, Err<E>>> + 'a

Iterate over memory reservations defined by this devicetree

Source

pub fn structure_iter<E: GeneralParseError<&'a [u8]>>( self: &'a Tree<'a>, ) -> impl Iterator<Item = Result<StructureData<'a>, Err<E>>>

Iterate over elements in the device tree. Note that this does not directly iterate over nodes, but rather events that indicate the start of a node (including its children), a property defined on the node, or the end of a node.

Trait Implementations§

Source§

impl<'a> Clone for Tree<'a>

Source§

fn clone(&self) -> Tree<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Tree<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Default for Tree<'a>

Source§

fn default() -> Tree<'a>

Returns the “default value” for a type. Read more
Source§

impl<'a> PartialEq for Tree<'a>

Source§

fn eq(&self, other: &Tree<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Copy for Tree<'a>

Source§

impl<'a> Eq for Tree<'a>

Source§

impl<'a> StructuralPartialEq for Tree<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Tree<'a>

§

impl<'a> RefUnwindSafe for Tree<'a>

§

impl<'a> Send for Tree<'a>

§

impl<'a> Sync for Tree<'a>

§

impl<'a> Unpin for Tree<'a>

§

impl<'a> UnwindSafe for Tree<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.