pub trait ResourceKind: Sized {
// Required methods
fn borrow_from(resource: &Resource) -> Option<&Self>;
fn take_from(resource: Resource) -> Option<Self>;
fn into_resource(self) -> Resource;
}Expand description
A kind of resource that can live in a ResourceGraph, and the resource an
id of that kind resolves to.
Implemented for the wgpu handles the graph stores and for Virtual, the
kind that holds no handle. The implementor is not just a tag: it is the
payload ResourceGraph::get hands out, so the kind and the resource read
as one thing — a ResHandle<wgpu::Buffer> names a buffer, not a mark
saying “buffer”.
Resource itself implements the trait as the erased kind: the one that
names a resource whose kind is known only at runtime.
Required Methods§
Sourcefn borrow_from(resource: &Resource) -> Option<&Self>
fn borrow_from(resource: &Resource) -> Option<&Self>
Borrow this kind out of a stored Resource, or None when that
resource is of another kind.
Sourcefn take_from(resource: Resource) -> Option<Self>
fn take_from(resource: Resource) -> Option<Self>
Take this kind out of a stored Resource, or None when that
resource is of another kind.
Sourcefn into_resource(self) -> Resource
fn into_resource(self) -> Resource
This value as a stored Resource.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".