soph_cache/support/
instance.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::{async_trait, error::Error, Cache};
use soph_core::{
    error::ContainerError,
    support::Container,
    traits::{ErrorTrait, InstanceTrait},
    Result,
};

#[async_trait]
impl InstanceTrait for Cache {
    type Error = Error;

    async fn register(_: &Container) -> Result<Self, ContainerError>
    where
        Self: Sized,
    {
        Ok(Self::new().map_err(Error::wrap)?)
    }
}