Trait PropReader

Source
pub trait PropReader<'dt> {
    type NodeType;

    // Required method
    fn node(&self) -> Self::NodeType;

    // Provided methods
    fn name(&self) -> Result<&'dt str> { ... }
    fn length(&self) -> usize { ... }
    fn u32(&self, index: usize) -> Result<u32> { ... }
    fn u64(&self, index: usize) -> Result<u64> { ... }
    fn phandle(&self, index: usize) -> Result<Phandle> { ... }
    fn str(&self) -> Result<&'dt str> { ... }
    fn iter_str(&self) -> StringPropIter<'dt> { ... }
    fn raw(&self) -> &'dt [u8]  { ... }
}

Required Associated Types§

Required Methods§

Source

fn node(&self) -> Self::NodeType

Returns the node which this property is contained within.

Provided Methods§

Source

fn name(&self) -> Result<&'dt str>

Returns the name of the property within the device tree.

Source

fn length(&self) -> usize

Returns the length of the property value within the device tree

Source

fn u32(&self, index: usize) -> Result<u32>

Read a big-endian u32 from the provided offset in this device tree property’s value. Convert the read value into the machines’ native u32 format and return it.

If an offset which would cause this read to access memory outside of this property’s value an Err containing DevTreeError::InvalidOffset will be returned.

Source

fn u64(&self, index: usize) -> Result<u64>

Read a big-endian u64 from the provided offset in this device tree property’s value. Convert the read value into the machines’ native u64 format and return it.

If an offset which would cause this read to access memory outside of this property’s value an Err containing DevTreeError::InvalidOffset will be returned.

Source

fn phandle(&self, index: usize) -> Result<Phandle>

A Phandle is simply defined as a u32 value, as such this method performs the same action as [self.u32]

Source

fn str(&self) -> Result<&'dt str>

Returns the string property as a string if it can be parsed as one.

§Safety

See the safety note of PropReader::u32

Source

fn iter_str(&self) -> StringPropIter<'dt>

Returns the property as a string fallible_iterator.

§Safety

See the safety note of PropReader::u32

Source

fn raw(&self) -> &'dt [u8]

Returns this property’s data as a raw slice

§Safety

See the safety note of [PropReader::get_u32]

Implementors§

Source§

impl<'a, 'i: 'a, 'dt: 'i> PropReader<'dt> for DevTreeIndexProp<'a, 'i, 'dt>

Source§

impl<'r, 'dt: 'r> PropReader<'dt> for DevTreeProp<'r, 'dt>