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
6#[cfg(feature = "std")]
7extern crate std;
8
9pub mod api;
10pub mod jq;
11
12mod engine;
13mod engines;
14
15use engine::Engine;
16
17pub fn find_engine_for(url: impl AsRef<str>) -> Option<&'static Engine> {
18    let url = url.as_ref();
19    for (url_pattern, engine) in engines::URL_PREFIX_TO_ENGINE.iter().rev() {
20        if url.starts_with(url_pattern) {
21            return Some(engine);
22        }
23    }
24    None // not found
25}