Skip to main content

Memory

Struct Memory 

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

Memory node describing physical memory layout.

This node type represents memory nodes in the device tree, which describe the physical memory layout available to the system. The reg property contains one or more memory regions.

Implementations§

Source§

impl<'a> Memory<'a>

Source

pub fn regions(&self) -> impl Iterator<Item = MemoryRegion> + 'a

Returns an iterator over memory regions.

The reg property of a memory node describes the physical memory layout, with each entry specifying a base address and size.

Source

pub fn regions_array<const N: usize>(&self) -> Vec<MemoryRegion, N>

Returns all memory regions as a fixed-size array.

This is useful for no_std environments where heap allocation is not available. Returns a heapless::Vec with at most N entries.

Source

pub fn total_size(&self) -> u64

Returns the total memory size across all regions.

Methods from Deref<Target = NodeBase<'a>>§

Source

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

Returns the node’s name.

Source

pub fn level(&self) -> usize

Returns the depth/level of this node in the tree.

Source

pub fn properties(&self) -> PropIter<'a>

Returns an iterator over this node’s properties.

Source

pub fn find_property(&self, name: &str) -> Option<Property<'a>>

Finds a property by name.

Source

pub fn find_property_str(&self, name: &str) -> Option<&'a str>

Finds a string property by name.

Source

pub fn reg(&self) -> Option<RegIter<'a>>

Finds and parses the reg property, returning a Reg iterator.

Source

pub fn reg_array<const N: usize>(&self) -> Vec<RegInfo, N>

Finds and parses the reg property, returning all RegInfo entries.

Source

pub fn ranges(&self) -> Option<VecRange<'a>>

Returns the ranges property if present.

Source

pub fn compatibles(&self) -> impl Iterator<Item = &'a str>

Returns an iterator over compatible strings.

Source

pub fn path(&self) -> String<256>

Returns the full path of this node as a string.

For the root node, returns “/”. For other nodes, returns the absolute path like “/soc/serial@0”.

Trait Implementations§

Source§

impl<'a> Clone for Memory<'a>

Source§

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

Returns a duplicate 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 Debug for Memory<'_>

Source§

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

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

impl<'a> Deref for Memory<'a>

Source§

type Target = NodeBase<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for Memory<'a>

§

impl<'a> RefUnwindSafe for Memory<'a>

§

impl<'a> Send for Memory<'a>

§

impl<'a> Sync for Memory<'a>

§

impl<'a> Unpin for Memory<'a>

§

impl<'a> UnwindSafe for Memory<'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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.