fn fetch_object_histogram(contents: &Map<String, Value>) -> Option<&Vec<serde_json::Value>> {
    if contents.len() != 1 {
        return None;
    }

    if let Some(serde_json::Value::Array(vec)) = contents.get(&*HISTOGRAM_OBJECT_KEY) {
        if let Some(serde_json::Value::Object(obj)) = vec.first() {
            let obj_is_histogram_bucket = REQUIRED_BUCKET_KEYS.iter().all(|k| obj.contains_key(*k));
            if obj_is_histogram_bucket {
                return Some(vec);
            }
        }
    }
    None
}
/// Pattern matches on the expected structure of a Histogram serialization, and returns
/// the underlying bucket vector if it matches, otherwise returns None.
Pattern matches on the expected structure of a Histogram serialization, and returns
the underlying bucket vector if it matches, otherwise returns None.
Pattern matches on the expected structure of a Histogram serialization and returns the underlying bucket vector if it matches otherwise returns None .
fn fetch_object_histogram(contents: &Map<String, Value>) -> Option<&Vec<serde_json::Value>> {
    if contents.len() != 1 {
        return None;
    }
    if let Some(serde_json::Value::Array(vec)) = contents.get(&*HISTOGRAM_OBJECT_KEY) {
        if let Some(serde_json::Value::Object(obj)) = vec.first() {
            let obj_is_histogram_bucket = REQUIRED_BUCKET_KEYS.iter().all(|k| obj.contains_key(*k));
            if obj_is_histogram_bucket {
                return Some(vec);
            }
        }
    }
    None
}
fn fetch_object_histogram ( contents : & Map < String , Value > ) -> Option < & Vec < serde_json :: Value > > { if contents . len ( ) != 1 { return None ; } if let Some ( serde_json :: Value :: Array ( vec ) ) = contents . get ( & * HISTOGRAM_OBJECT_KEY ) { if let Some ( serde_json :: Value :: Object ( obj ) ) = vec . first ( ) { let obj_is_histogram_bucket = REQUIRED_BUCKET_KEYS . iter ( ) . all ( | k | obj . contains_key ( * k ) ) ; if obj_is_histogram_bucket { return Some ( vec ) ; } } } None }
Pattern matches on the expected structure of a Histogram serialization, and returns
the underlying bucket vector if it matches, otherwise returns None.
Pattern matches on the expected structure of a Histogram serialization and returns the underlying bucket vector if it matches otherwise returns None .
contents
&Map<String, Value>