pub struct Property {
pub name: String,
pub data: Vec<u8>,
}Expand description
A mutable device tree property.
Represents a property with a name and raw data. Provides methods for accessing and modifying the data in various formats (u32, u64, strings, etc.).
Fields§
§name: StringProperty name
data: Vec<u8>Raw property data
Implementations§
Source§impl Property
impl Property
Sourcepub fn new(name: &str, data: Vec<u8>) -> Self
pub fn new(name: &str, data: Vec<u8>) -> Self
Creates a new property with the given name and data.
Sourcepub fn get_u32(&self) -> Option<u32>
pub fn get_u32(&self) -> Option<u32>
Returns the property data as a big-endian u32.
Returns None if the data is not exactly 4 bytes.
Sourcepub fn set_u32_ls(&mut self, values: &[u32])
pub fn set_u32_ls(&mut self, values: &[u32])
Sets the property data from a list of u32 values (as big-endian).
Sourcepub fn get_u32_iter(&self) -> U32Iter<'_>
pub fn get_u32_iter(&self) -> U32Iter<'_>
Returns an iterator over u32 values in the property data.
Sourcepub fn get_u64(&self) -> Option<u64>
pub fn get_u64(&self) -> Option<u64>
Returns the property data as a big-endian u64.
Returns None if the data is not exactly 8 bytes.
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
Returns the property data as a null-terminated string.
Returns None if the data is not a valid null-terminated UTF-8 string.
Sourcepub fn set_string(&mut self, value: &str)
pub fn set_string(&mut self, value: &str)
Sets the property data from a string value.
The string will be null-terminated.
Sourcepub fn as_str_iter(&self) -> StrIter<'_>
pub fn as_str_iter(&self) -> StrIter<'_>
Returns an iterator over null-terminated strings in the property data.
Sourcepub fn set_string_ls(&mut self, values: &[&str])
pub fn set_string_ls(&mut self, values: &[&str])
Sets the property data from a list of string values.
Each string will be null-terminated.