hermes_cli_components/impls/config/
get_config_path.rs

1use core::marker::PhantomData;
2
3use cgp::prelude::*;
4use hermes_runtime_components::traits::fs::file_path::HasFilePathType;
5use hermes_runtime_components::traits::runtime::HasRuntime;
6
7use crate::traits::config::config_path::ConfigPathGetter;
8
9pub struct GetConfigField<Key>(pub PhantomData<Key>);
10
11pub type GetDefaultConfigField = GetConfigField<symbol!("config_path")>;
12
13impl<App, Key, Runtime> ConfigPathGetter<App> for GetConfigField<Key>
14where
15    App: HasRuntime<Runtime = Runtime> + HasField<Key, Field = Runtime::FilePath>,
16    Runtime: HasFilePathType,
17    Key: Async,
18{
19    fn config_path(app: &App) -> &Runtime::FilePath {
20        app.get_field(PhantomData)
21    }
22}