[][src]Trait mail_core::ContainedResourcesAccess

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; }

Associated Types

Loading content...

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.

Loading content...

Implementations on Foreign Types

impl ContainedResourcesAccess for Vec<Resource>
[src]

Return a ref for a resource base on given key.

impl ContainedResourcesAccess for HashMap<String, Resource>
[src]

Return a ref for a resource base on given key.

Loading content...

Implementors

Loading content...