pub trait ContainedResourcesAccess {
    type Key: ToOwned + ?Sized;

    fn visit_resources(&self, visitor: &mut impl FnMut(&Self::Key, &Resource));
    fn access_resource_mut<R>(
        &mut self,
        key: &Self::Key,
        modify: impl FnOnce(Option<&mut Resource>) -> R
    ) -> R; fn access_resource<R>(
        &self,
        key: &Self::Key,
        modify: impl FnOnce(Option<&Resource>) -> R
    ) -> R; }

Required Associated Types

Required Methods

Visit all resources.

This method is not allowed to be implemented in a way that it might visit resources, which are not accessable with [Self.access_resource_mut()]. This means that without e.g. a RwLock this can not visit resources in a Arc.

Return a mut ref for a resource based on given key.

If a resource is visited in a Self.visit_resources() call and the state of self was not changes this method has to be able to return a mut reference to it.

To allow accessing resources in a mutext this does pass the mut ref to a closure instead of returning it.

Return a ref for a resource base on given key.

Implementations on Foreign Types

Return a ref for a resource base on given key.

Return a ref for a resource base on given key.

Implementors