Struct vm_resource::ResourceResolver
source · pub struct ResourceResolver { /* private fields */ }
Expand description
A resource resolver capable of resolving resources of multiple types and kinds.
Implementations§
source§impl ResourceResolver
impl ResourceResolver
sourcepub fn new() -> Self
pub fn new() -> Self
Returns a new resolver, which initially only supports the static resolvers.
sourcepub fn add_resolver<K, O, T, R>(&mut self, resolver: R)where
K: CanResolveTo<O>,
O: 'static,
T: ResourceId<K> + MeshPayload,
R: 'static + ResolveResource<K, T, Output = O>,
pub fn add_resolver<K, O, T, R>(&mut self, resolver: R)where
K: CanResolveTo<O>,
O: 'static,
T: ResourceId<K> + MeshPayload,
R: 'static + ResolveResource<K, T, Output = O>,
Adds a dynamic resolver.
Panics if a resolver already exists for this resource type.
sourcepub fn add_async_resolver<K, O, T, R>(&mut self, resolver: R)where
K: CanResolveTo<O>,
O: 'static,
T: ResourceId<K> + MeshPayload,
R: 'static + AsyncResolveResource<K, T, Output = O>,
pub fn add_async_resolver<K, O, T, R>(&mut self, resolver: R)where
K: CanResolveTo<O>,
O: 'static,
T: ResourceId<K> + MeshPayload,
R: 'static + AsyncResolveResource<K, T, Output = O>,
Adds a dynamic async resolver.
Panics if a resolver already exists for this resource type.
sourcepub async fn resolve<K: CanResolveTo<O>, O: 'static>(
&self,
resource: Resource<K>,
input: K::Input<'_>,
) -> Result<O, ResolveError>
pub async fn resolve<K: CanResolveTo<O>, O: 'static>( &self, resource: Resource<K>, input: K::Input<'_>, ) -> Result<O, ResolveError>
Resolves a resource.
Trait Implementations§
source§impl Clone for ResourceResolver
impl Clone for ResourceResolver
source§fn clone(&self) -> ResourceResolver
fn clone(&self) -> ResourceResolver
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ResourceResolver
impl !RefUnwindSafe for ResourceResolver
impl Send for ResourceResolver
impl Sync for ResourceResolver
impl Unpin for ResourceResolver
impl !UnwindSafe for ResourceResolver
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)