Function accept_language::intersection_ordered
source · pub fn intersection_ordered(
raw_languages: &str,
supported_languages: &[&str]
) -> Vec<String>
Expand description
Similar to intersection
but using binary sort. The supported languages
MUST be in alphabetical order, to find the common languages that could be presented
to a user. Executes roughly 25% faster.
Example
use accept_language::intersection_ordered;
let common_languages = intersection_ordered("en-US, en-GB;q=0.5", &["de", "en-GB", "en-US"]);