soph_cache/support/
instance.rs

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

#[async_trait]
impl InstanceTrait for Cache {
    type Config = config::Cache;

    async fn register(_: &Container) -> Result<Self, ContainerError>
    where
        Self: Sized,
    {
        let config = config().parse::<Self::Config>()?;

        Ok(Self::new(config))
    }
}