fn decode(&mut self, data: &str) -> bool {
        match json::parse(data) {
            Ok(input) => {
                for (key, value) in input.entries() {
                    match key.to_lowercase().as_ref() {
                        "max_history_size" => {
                            self.max_history_size =
                                value.as_usize().unwrap_or(self.max_history_size)
                        }
                        "edit_mode" => {
                            self.edit_mode = match value.as_str().unwrap_or("emacs") {
                                        "vi" => EditMode::Vi,
                                        _ /*"emacs"*/ => EditMode::Emacs,
                                    };
                        }
                        "completion_type" => {
                            self.completion_type = match value.as_str().unwrap_or("list") {
                                "circular" => CompletionType::Circular,
                                _ /*"list"*/ => CompletionType::List,
                            };
                        }
                        "auto_cd" => {
                            self.auto_cd = value.as_bool().unwrap_or(true);
                        }
                        "aliases" => {
                            self.aliases = util::json_obj_to_hash_map(value);
                        }
                        "env" => {
                            self.env = util::json_obj_to_hash_map(value);
                        }
                        _ => println!("Unknown config entry: {}={}", key, value),
                    }
                }
                return true;
            }
            Err(err) => println!("Could not parse config: {}", err),
        }
        false
    }
/// Decodes JSON `data` into config values.
Decodes JSON `data` into config values.
Decodes JSON ` data ` into config values .
fn decode(&mut self, data: &str) -> bool {
        match json::parse(data) {
            Ok(input) => {
                for (key, value) in input.entries() {
                    match key.to_lowercase().as_ref() {
                        "max_history_size" => {
                            self.max_history_size =
                                value.as_usize().unwrap_or(self.max_history_size)
                        }
                        "edit_mode" => {
                            self.edit_mode = match value.as_str().unwrap_or("emacs") {
                                        "vi" => EditMode::Vi,
                                        _ /*"emacs"*/ => EditMode::Emacs,
                                    };
                        }
                        "completion_type" => {
                            self.completion_type = match value.as_str().unwrap_or("list") {
                                "circular" => CompletionType::Circular,
                                _ /*"list"*/ => CompletionType::List,
                            };
                        }
                        "auto_cd" => {
                            self.auto_cd = value.as_bool().unwrap_or(true);
                        }
                        "aliases" => {
                            self.aliases = util::json_obj_to_hash_map(value);
                        }
                        "env" => {
                            self.env = util::json_obj_to_hash_map(value);
                        }
                        _ => println!("Unknown config entry: {}={}", key, value),
                    }
                }
                return true;
            }
            Err(err) => println!("Could not parse config: {}", err),
        }
        false
    }
fn decode ( & mut self , data : & str ) -> bool { match json :: parse ( data ) { Ok ( input ) => { for ( key , value ) in input . entries ( ) { match key . to_lowercase ( ) . as_ref ( ) { " " => { self . max_history_size = value . as_usize ( ) . unwrap_or ( self . max_history_size ) } " " => { self . edit_mode = match value . as_str ( ) . unwrap_or ( " " ) { " " => EditMode :: Vi , _ /*"emacs"*/ => EditMode :: Emacs , } ; } " " => { self . completion_type = match value . as_str ( ) . unwrap_or ( " " ) { " " => CompletionType :: Circular , _ /*"list"*/ => CompletionType :: List , } ; } " " => { self . auto_cd = value . as_bool ( ) . unwrap_or ( true ) ; } " " => { self . aliases = util :: json_obj_to_hash_map ( value ) ; } " " => { self . env = util :: json_obj_to_hash_map ( value ) ; } _ => println ! ( " " key value ) , } } return true ; } Err ( err ) => println ! ( " " err ) , } false }
Decodes JSON `data` into config values.
Decodes JSON ` data ` into config values .
&mut self
data
&str