[−][src]Struct fdt_rs::DevTreeProp
A handle to a DevTreeNode's Device Tree Property
Implementations
impl<'a> DevTreeProp<'a>[src]
pub fn name(&self) -> Result<&'a Str, DevTreeError>[src]
Returns the name of the property within the device tree.
#[must_use]pub fn parent(&self) -> DevTreeNode<'a>[src]
Returns the node which this property is attached to
#[must_use]pub fn length(&self) -> usize[src]
Returns the length of the property value within the device tree
pub unsafe fn get_u32(&self, offset: usize) -> Result<u32, DevTreeError>[src]
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.
Safety
Device Tree Properties are not strongly typed therefore any dereference could return unexpected data.
This method will access memory using core::ptr::read_unaligned, therefore an unaligned
offset may be provided.
This method will not panic.
pub unsafe fn get_u64(&self, offset: usize) -> Result<u64, DevTreeError>[src]
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.
Safety
See the safety note of DevTreeProp::get_u32
pub unsafe fn get_phandle(&self, offset: usize) -> Result<Phandle, DevTreeError>[src]
A Phandle is simply defined as a u32 value, as such this method performs the same action as
[self.get_u32]
Safety
See the safety note of DevTreeProp::get_u32
pub unsafe fn get_str(&'a self) -> Result<&'a Str, DevTreeError>[src]
Returns the string property as a string if it can be parsed as one.
Safety
See the safety note of DevTreeProp::get_u32
pub unsafe fn get_str_at(
&'a self,
offset: usize
) -> Result<&'a Str, DevTreeError>[src]
&'a self,
offset: usize
) -> Result<&'a Str, DevTreeError>
Returns the string at the given offset within the property.
Safety
See the safety note of DevTreeProp::get_u32
pub unsafe fn get_str_count(&self) -> Result<usize, DevTreeError>[src]
Safety
See the safety note of DevTreeProp::get_u32
pub unsafe fn get_strlist(
&'a self,
list: &mut [Option<&'a Str>]
) -> Result<usize, DevTreeError>[src]
&'a self,
list: &mut [Option<&'a Str>]
) -> Result<usize, DevTreeError>
Fills the supplied slice of references with Str slices parsed from the given property.
If parsing is successful, the number of parsed strings will be returned.
If an error occurred parsing one or more of the strings (E.g. they were not valid
UTF-8/ASCII strings) an Err of type DevTreeError will be returned.
// Get the number of possible strings if let Ok(count) = prop.get_str_count() { // Allocate a vector to store the strings let mut vec: Vec<Option<&Str>> = vec![None; count]; // Read and parse the strings if let Ok(_) = prop.get_strlist(&mut vec) { let mut iter = vec.iter(); // Print out all the strings we found in the property while let Some(Some(s)) = iter.next() { print!("{} ", s); } } }
Safety
See the safety note of DevTreeProp::get_u32
pub unsafe fn get_raw(&self) -> &'a [u8][src]
Safety
See the safety note of DevTreeProp::get_u32
Trait Implementations
impl<'a> Clone for DevTreeProp<'a>[src]
fn clone(&self) -> DevTreeProp<'a>[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for DevTreeProp<'a>
impl<'a> Send for DevTreeProp<'a>
impl<'a> Sync for DevTreeProp<'a>
impl<'a> Unpin for DevTreeProp<'a>
impl<'a> UnwindSafe for DevTreeProp<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,