/// Read a config file (or really any JSON/JSON5 file) into a instance of type
/// T, with a useful error context if it fails.
Read a config file (or really any JSON/JSON5 file) into a instance of type
T, with a useful error context if it fails.
Read a config file ( or really any JSON / JSON5 file ) into a instance of type T with a useful error context if it fails .
pub fn read_config<T>(path: impl AsRef<Path>) -> Result<T>
where
    T: serde::de::DeserializeOwned,
{
    let mut file = File::open(path.as_ref())
        .context(format!("Unable to open file: {}", path.as_ref().display()))?;
    assembly_util::from_reader(&mut file)
        .context(format!("Unable to read file: {}", path.as_ref().display()))
}
pub fn read_config < T > ( path : impl AsRef < Path > ) -> Result < T > where T : serde :: de :: DeserializeOwned , { let mut file = File :: open ( path . as_ref ( ) ) . context ( format ! ( " " path as_ref ( ) display ( ) ) ) ? ; assembly_util :: from_reader ( & mut file ) . context ( format ! ( " " path as_ref ( ) display ( ) ) ) }
Read a config file (or really any JSON/JSON5 file) into a instance of type
T, with a useful error context if it fails.
Read a config file ( or really any JSON / JSON5 file ) into a instance of type T with a useful error context if it fails .
path
impl AsRef<Path>