suggest/
lib.rs

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")]
7pub mod benchmarks;
8mod config;
9mod db;
10mod error;
11mod geoname;
12mod metrics;
13mod provider;
14mod query;
15mod rs;
16mod schema;
17mod store;
18mod suggestion;
19#[cfg(test)]
20mod testing;
21pub mod util;
22mod weather;
23mod yelp;
24
25pub use config::{SuggestGlobalConfig, SuggestProviderConfig};
26pub use error::{Error, SuggestApiError};
27pub use geoname::{Geoname, GeonameMatch};
28pub use metrics::{LabeledTimingSample, SuggestIngestionMetrics};
29pub use provider::{AmpMatchingStrategy, SuggestionProvider, SuggestionProviderConstraints};
30pub use query::{QueryWithMetricsResult, SuggestionQuery};
31pub use store::{InterruptKind, SuggestIngestionConstraints, SuggestStore, SuggestStoreBuilder};
32pub use suggestion::{raw_suggestion_url_matches, Suggestion};
33
34pub(crate) type Result<T> = std::result::Result<T, Error>;
35pub type SuggestApiResult<T> = std::result::Result<T, SuggestApiError>;
36
37uniffi::setup_scaffolding!();
38
39use serde_json::Value as JsonValue;
40
41uniffi::custom_type!(JsonValue, String, {
42    remote,
43    try_lift: |val| serde_json::from_str(val.as_str()).map_err(Into::into),
44    lower: |obj| obj.to_string(),
45});