/// Reads the supplied JSON file path and parses into a `SystemPowerModeConfig` instance.
///
/// Attempts to open, read, and parse the supplied JSON file into a valid
/// `SystemPowerModeConfig` instance. If parsing was successful, then it is also tested for
/// validity. If a `SystemPowerModeConfig` instance could not be created, or validation fails,
/// then an error is returned.
Reads the supplied JSON file path and parses into a `SystemPowerModeConfig` instance.
Attempts to open, read, and parse the supplied JSON file into a valid
`SystemPowerModeConfig` instance. If parsing was successful, then it is also tested for
validity. If a `SystemPowerModeConfig` instance could not be created, or validation fails,
then an error is returned.
Reads the supplied JSON file path and parses into a ` SystemPowerModeConfig ` instance . Attempts to open read and parse the supplied JSON file into a valid ` SystemPowerModeConfig ` instance . If parsing was successful then it is also tested for validity . If a ` SystemPowerModeConfig ` instance could not be created or validation fails then an error is returned .
pub fn read(json_file_path: &Path) -> Result<SystemPowerModeConfig, Error> {
        let mut buffer = String::new();
        File::open(&json_file_path)
            .context(format!("Failed to open file at path {}", json_file_path.display()))?
            .read_to_string(&mut buffer)?;
        let config = Self::from_json_str(&buffer)?;
        config.validate().context("SystemPowerModeConfig validation failed")?;
        Ok(config)
    }
pub fn read ( json_file_path : & Path ) -> Result < SystemPowerModeConfig , Error > { let mut buffer = String :: new ( ) ; File :: open ( & json_file_path ) . context ( format ! ( " " json_file_path display ( ) ) ) ? . read_to_string ( & mut buffer ) ? ; let config = Self :: from_json_str ( & buffer ) ? ; config . validate ( ) . context ( " " ) ? ; Ok ( config ) }
Reads the supplied JSON file path and parses into a `SystemPowerModeConfig` instance.
Reads the supplied JSON file path and parses into a ` SystemPowerModeConfig ` instance .
json_file_path
&Path