Property

Struct Property 

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

通用属性,包含名称和原始数据

Implementations§

Source§

impl<'a> Property<'a>

Source

pub fn new(name: &'a str, data: Bytes<'a>) -> Self

Source

pub fn name(&self) -> &'a str

Source

pub fn data(&self) -> Bytes<'a>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn as_u32_iter(&self) -> U32Iter<'a>

作为 u32 迭代器

Source

pub fn as_str_iter(&self) -> StrIter<'a>

作为字符串迭代器(用于 compatible 等属性)

Source

pub fn as_slice(&self) -> &[u8]

获取数据作为字节切片

Source

pub fn as_u64(&self) -> Option<u64>

作为单个 u64 值

Source

pub fn as_u32(&self) -> Option<u32>

作为单个 u32 值

Source

pub fn as_str(&self) -> Option<&'a str>

作为字符串

Source

pub fn as_address_cells(&self) -> Option<u8>

获取为 #address-cells 值

Source

pub fn as_size_cells(&self) -> Option<u8>

获取为 #size-cells 值

Source

pub fn as_interrupt_cells(&self) -> Option<u8>

获取为 #interrupt-cells 值

Source

pub fn as_status(&self) -> Option<Status>

获取为 status 枚举

Source

pub fn as_phandle(&self) -> Option<Phandle>

获取为 phandle

Source

pub fn as_device_type(&self) -> Option<&'a str>

获取为 device_type 字符串

Source

pub fn as_interrupt_parent(&self) -> Option<Phandle>

获取为 interrupt-parent

Source

pub fn as_clock_names(&self) -> Option<StrIter<'a>>

获取为 clock-names 字符串列表

Source

pub fn as_compatible(&self) -> Option<StrIter<'a>>

获取为 compatible 字符串列表

Source

pub fn is_dma_coherent(&self) -> bool

是否为 dma-coherent 属性

Trait Implementations§

Source§

impl<'a> Clone for Property<'a>

Source§

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

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Display for Property<'_>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Property<'a>

§

impl<'a> RefUnwindSafe for Property<'a>

§

impl<'a> Send for Property<'a>

§

impl<'a> Sync for Property<'a>

§

impl<'a> Unpin for Property<'a>

§

impl<'a> UnwindSafe for Property<'a>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T, U> TryFrom<U> for T
where 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>

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.