asimov_serpapi_module/
lib.rs

1// This is free and unencumbered software released into the public domain.
2
3#![no_std]
4#![forbid(unsafe_code)]
5
6pub mod api;
7
8mod engine;
9mod engines;
10
11use engine::Engine;
12
13pub fn find_engine_for(url: impl AsRef<str>) -> Option<&'static Engine> {
14    let url = url.as_ref();
15    for (url_prefix, dataset) in engines::URL_PREFIX_TO_ENGINE.iter().rev() {
16        if url.starts_with(url_prefix) {
17            return Some(dataset);
18        }
19    }
20    None // not found
21}