Crate vm_resource

Source
Expand description

Infrastructure for type-erased “resource” types, representing interchangeable resources that can be resolved into the same type at runtime.

This allows a device’s resources to be described via mesh messages so that the device initialization code does not have to be statically aware of all the different possible resource types (e.g. via an enum). VMMs can link in different resource resolvers to support different resource types depending on compile-time configuration.

Modules§

kind
Resource kind definitions that are used by multiple devices.

Macros§

declare_static_async_resolver
Declares the resource kinds and types that an async static resolver can resolve.
declare_static_resolver
Declares the resource kinds and types that a static resolver can resolve.
register_static_resolvers
Registers a static resolver, declared via declare_static_resolver or declare_static_async_resolver, so that it is automatically available to any ResourceResolver in the binary.

Structs§

PlatformResource
The generic resource defined for all resource kinds.
Resource
An opaque resource of kind K, for erasing the resource’s type.
ResourceResolver
A resource resolver capable of resolving resources of multiple types and kinds.

Enums§

ResolveError
An error returned by ResourceResolver::resolve.

Traits§

AsyncResolveResource
Trait implemented to resolve resource type T as resource kind K.
CanResolveTo
Trait specifying that a ResourceKind can be resolved to a given output type.
IntoResource
Trait for converting resources into opaque Resources.
ResolveResource
Trait implemented to resolve resource type T as resource kind K.
ResourceId
A trait identifying a resource type’s ID (within a given ResourceKind).
ResourceKind
Trait implemented by resource kinds.