fn new_from_json(json_data: Option<json::Value>) -> Self {
        #[derive(Deserialize)]
        struct DriverAlias {
            /// Human-readable alias.
            name: String,
            /// Topological path.
            topological_path: String,
        }
        #[derive(Deserialize)]
        struct Config {
            drivers: Vec<DriverAlias>,
        }
        let config: Option<Config> = json_data.map(|d| json::from_value(d).unwrap());

        let topo_to_alias: HashMap<String, String> = config.map_or(HashMap::new(), |c| {
            c.drivers.into_iter().map(|m| (m.topological_path, m.name)).collect()
        });

        ServerBuilder {
            temperature_driver_aliases: topo_to_alias,
            temperature_drivers: None,
            cpu_stats_proxy: None,
            inspect_root: None,
        }
    }
/// Constructs a new ServerBuilder from a JSON configuration.
Constructs a new ServerBuilder from a JSON configuration.
Constructs a new ServerBuilder from a JSON configuration .
fn new_from_json(json_data: Option<json::Value>) -> Self {
        #[derive(Deserialize)]
        struct DriverAlias {
            /// Human-readable alias.
            name: String,
            /// Topological path.
            topological_path: String,
        }
        #[derive(Deserialize)]
        struct Config {
            drivers: Vec<DriverAlias>,
        }
        let config: Option<Config> = json_data.map(|d| json::from_value(d).unwrap());
        let topo_to_alias: HashMap<String, String> = config.map_or(HashMap::new(), |c| {
            c.drivers.into_iter().map(|m| (m.topological_path, m.name)).collect()
        });
        ServerBuilder {
            temperature_driver_aliases: topo_to_alias,
            temperature_drivers: None,
            cpu_stats_proxy: None,
            inspect_root: None,
        }
    }
fn new_from_json ( json_data : Option < json :: Value > ) -> Self { # [ derive ( Deserialize ) ] struct DriverAlias { /// Human-readable alias. name : String , /// Topological path. topological_path : String , } # [ derive ( Deserialize ) ] struct Config { drivers : Vec < DriverAlias > , } let config : Option < Config > = json_data . map ( | d | json :: from_value ( d ) . unwrap ( ) ) ; let topo_to_alias : HashMap < String , String > = config . map_or ( HashMap :: new ( ) , | c | { c . drivers . into_iter ( ) . map ( | m | ( m . topological_path , m . name ) ) . collect ( ) } ) ; ServerBuilder { temperature_driver_aliases : topo_to_alias , temperature_drivers : None , cpu_stats_proxy : None , inspect_root : None , } }
Constructs a new ServerBuilder from a JSON configuration.
Constructs a new ServerBuilder from a JSON configuration .
json_data
Option<json::Value>
json_data
Option<json::Value>