Skip to main content

ProvidedResources

Struct ProvidedResources 

Source
pub struct ProvidedResources<B> {
    pub provider: String,
    pub node_identity: String,
    pub resources: BTreeMap<ResourceId, MmioResource>,
    pub ceiling: BTreeMap<ResourceId, ResourceCeiling>,
    pub backends: BTreeMap<ResourceId, B>,
}
Expand description

Everything one provider acquired for the bound node.

Fields§

§provider: String

Provider kind, for example "platform", "embedded", or "fake". Feeds the per-resource digests.

§node_identity: String

Stable node identity criteria (for example the node moniker), never a per-boot numeric ID. Feeds the per-resource digests.

§resources: BTreeMap<ResourceId, MmioResource>

Logical resource descriptions, keyed by resource ordinal.

§ceiling: BTreeMap<ResourceId, ResourceCeiling>

Immutable ceiling entries. A resource with no entry permits nothing.

§backends: BTreeMap<ResourceId, B>

One backend per offered resource.

Implementations§

Source§

impl<B> ProvidedResources<B>

Source

pub fn empty(provider: &str, node_identity: &str) -> Self

An empty bundle: no resources, nothing reachable.

Source

pub fn embedded(node_identity: &str) -> Self

Creates an empty bundle for an embedded in-situ driver library.

Source

pub fn add_mmio( &mut self, id: ResourceId, name: impl Into<String>, logical_size: u64, mapped_size: u64, ceiling: ResourceCeiling, backend: B, )

Registers a pre-mapped MMIO bank with its logical size, actual mapped size, target ceiling policy, and backend.

Source

pub fn add_protocol( &mut self, id: ResourceId, name: impl Into<String>, kind: ResourceKind, ceiling: ProtocolCeiling, backend: B, )

Registers a protocol-backed resource (GPIO, I2C, SPI, Clock, Reset, Serial).

Source

pub fn add_interrupt( &mut self, id: ResourceId, name: impl Into<String>, backend: B, )

Registers an interrupt observation resource.

Source

pub fn validate(&self) -> Result<(), ProviderError>

Validates internal consistency. Driver start fails on error.

Source

pub fn digests(&self) -> BTreeMap<ResourceId, Sha256Digest>

Per-resource digests for this bundle, in ascending resource ID order.

Source

pub fn combined_digest(&self) -> Sha256Digest

The whole-instance resource digest for this bundle.

Trait Implementations§

Source§

impl<B: Debug> Debug for ProvidedResources<B>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<B> Freeze for ProvidedResources<B>

§

impl<B> RefUnwindSafe for ProvidedResources<B>
where B: RefUnwindSafe,

§

impl<B> Send for ProvidedResources<B>
where B: Send,

§

impl<B> Sync for ProvidedResources<B>
where B: Sync,

§

impl<B> Unpin for ProvidedResources<B>

§

impl<B> UnsafeUnpin for ProvidedResources<B>

§

impl<B> UnwindSafe for ProvidedResources<B>
where B: RefUnwindSafe,

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> 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<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.