From f1f8c65de7ad08a8208a00e5909cdbe907570ed7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 10 Nov 2014 18:18:12 -0500 Subject: [PATCH] embedding: cef_string_multimap_find_count() --- ports/cef/string_multimap.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ports/cef/string_multimap.rs b/ports/cef/string_multimap.rs index 6e4dcda1691..9bf02a54bcc 100644 --- a/ports/cef/string_multimap.rs +++ b/ports/cef/string_multimap.rs @@ -36,3 +36,19 @@ pub extern "C" fn cef_string_multimap_size(smm: *mut cef_string_multimap_t) -> c c } } + +#[no_mangle] +pub extern "C" fn cef_string_multimap_find_count(smm: *mut cef_string_multimap_t, key: *const cef_string_t) -> c_int { + unsafe { + if smm.is_null() { return 0; } + let v = string_multimap_to_treemap(smm); + slice_to_str((*key).str as *const u8, (*key).length as uint, |result| { + match (*v).find(&String::from_str(result)) { + Some(s) => { + s.len() as c_int + } + None => 0 + } + }) + } +}