Debian Codegraph @

third_party/rust/suggest/src/lib.rs

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 */
5
6 #[cfg(feature = "benchmark_api")]
7 pub mod benchmarks;
8 mod config;
9 mod db;
10 mod error;
11 mod fakespot;
12 mod geoname;
13 mod metrics;
14 pub mod pocket;
15 mod provider;
16 mod query;
17 mod rs;
18 mod schema;
19 mod store;
20 mod suggestion;
21 #[cfg(test)]
22 mod testing;
23 pub mod util;
24 mod weather;
25 mod yelp;
26
27 pub use config::{SuggestGlobalConfig, SuggestProviderConfig};
28 pub use error::{Error, SuggestApiError};
29 pub use geoname::{Geoname, GeonameMatch};
30 pub use metrics::{LabeledTimingSample, SuggestIngestionMetrics};
31 pub use provider::{AmpMatchingStrategy, SuggestionProvider, SuggestionProviderConstraints};
32 pub use query::{QueryWithMetricsResult, SuggestionQuery};
33 pub use store::{InterruptKind, SuggestIngestionConstraints, SuggestStore, SuggestStoreBuilder};
34 pub use suggestion::{raw_suggestion_url_matches, Suggestion};
35
36 pub(crate) type Result<T> = std::result::Result<T, Error>;
37 pub type SuggestApiResult<T> = std::result::Result<T, SuggestApiError>;
38
39 uniffi::setup_scaffolding!();
40
41 use serde_json::Value as JsonValue;
42
43 uniffi::custom_type!(JsonValue, String, {
44 remote,
45 try_lift: |val| serde_json::from_str(val.as_str()).map_err(Into::into),
46 lower: |obj| obj.to_string(),
47 });