asimov_apify_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 actor;
13mod actors;
14
15use actor::Actor;
16
17pub fn find_actor_for(url: impl AsRef<str>) -> Option<&'static Actor> {
18 let url = url.as_ref();
19 for (url_pattern, actor) in actors::URL_PREFIX_TO_ACTOR.iter().rev() {
20 if url.starts_with(url_pattern) {
21 return Some(actor);
22 }
23 }
24 None // not found
25}