fn check_field_is_string(map: &Map<String, Value>, field_key: &str) -> Result<(), String> {
        match map.get(field_key) {
            None => {
                return Err(format!(
                    "Required key {} not present in the json.",
                    field_key
                ));
            }
            Some(id) => {
                // Check that field is a string.
                if id.as_str().is_none() {
                    return Err(format!("Invalid type for key {}.", field_key));
                }
            }
        }
        Ok(())
    }
/// Checks that `field_key` exists and that the value has the type Value::String.
Checks that `field_key` exists and that the value has the type Value::String.
Checks that ` field_key ` exists and that the value has the type Value :: String .
fn check_field_is_string(map: &Map<String, Value>, field_key: &str) -> Result<(), String> {
        match map.get(field_key) {
            None => {
                return Err(format!(
                    "Required key {} not present in the json.",
                    field_key
                ));
            }
            Some(id) => {
                // Check that field is a string.
                if id.as_str().is_none() {
                    return Err(format!("Invalid type for key {}.", field_key));
                }
            }
        }
        Ok(())
    }
fn check_field_is_string ( map : & Map < String , Value > , field_key : & str ) -> Result < ( ) , String > { match map . get ( field_key ) { None => { return Err ( format ! ( " " field_key ) ) ; } Some ( id ) => { // Check that field is a string. if id . as_str ( ) . is_none ( ) { return Err ( format ! ( " " field_key ) ) ; } } } Ok ( ( ) ) }
Checks that `field_key` exists and that the value has the type Value::String.
Checks that ` field_key ` exists and that the value has the type Value :: String .
map
&Map<String, Value>
field_key
&str
map
&Map<String, Value>
field_key
&str