Bug 1885440 - Vendor in the relevancy component. r=nanj

I also took this chance to vendor in the newest app-services revision
for other components.

Differential Revision: https://phabricator.services.mozilla.com/D204704
This commit is contained in:
Ben Dean-Kawamura 2024-03-19 12:46:52 +00:00
Родитель 3768a865b8
Коммит 7e42f22388
47 изменённых файлов: 4232 добавлений и 659 удалений

Просмотреть файл

@ -55,9 +55,9 @@ git = "https://github.com/mozilla-spidermonkey/jsparagus"
rev = "61f399c53a641ebd3077c1f39f054f6d396a633c"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f"]
[source."git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706"]
git = "https://github.com/mozilla/application-services"
rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f"
rev = "9054db4bb5031881550ceab3448665ef6499a706"
replace-with = "vendored-sources"
[source."git+https://github.com/mozilla/audioipc?rev=409e11f8de6288e9ddfe269654523735302e59e6"]

41
Cargo.lock сгенерированный
Просмотреть файл

@ -1595,7 +1595,7 @@ dependencies = [
[[package]]
name = "error-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"error-support-macros",
"lazy_static",
@ -1607,7 +1607,7 @@ dependencies = [
[[package]]
name = "error-support-macros"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"proc-macro2",
"quote",
@ -2247,6 +2247,7 @@ dependencies = [
"processtools",
"profiler_helper",
"qcms",
"relevancy",
"rsdparsa_capi",
"rure",
"rusqlite",
@ -2864,7 +2865,7 @@ dependencies = [
[[package]]
name = "interrupt-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"lazy_static",
"parking_lot",
@ -4057,7 +4058,7 @@ dependencies = [
[[package]]
name = "nss_build_common"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
[[package]]
name = "nsstring"
@ -4739,10 +4740,26 @@ version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
[[package]]
name = "relevancy"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"error-support",
"log",
"md-5",
"parking_lot",
"rusqlite",
"sql-support",
"thiserror",
"uniffi",
"url",
]
[[package]]
name = "remote_settings"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"parking_lot",
"serde",
@ -5265,7 +5282,7 @@ dependencies = [
[[package]]
name = "sql-support"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"ffi-support",
"interrupt-support",
@ -5446,7 +5463,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
[[package]]
name = "suggest"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"anyhow",
"chrono",
@ -5495,7 +5512,7 @@ dependencies = [
[[package]]
name = "sync-guid"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"base64 0.21.3",
"rand",
@ -5506,7 +5523,7 @@ dependencies = [
[[package]]
name = "sync15"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"anyhow",
"error-support",
@ -5538,7 +5555,7 @@ dependencies = [
[[package]]
name = "tabs"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"anyhow",
"error-support",
@ -6190,7 +6207,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "viaduct"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"ffi-support",
"log",
@ -6336,7 +6353,7 @@ dependencies = [
[[package]]
name = "webext-storage"
version = "0.1.0"
source = "git+https://github.com/mozilla/application-services?rev=5fc8ee2f0f6950e36d4096983757bd046d55df9f#5fc8ee2f0f6950e36d4096983757bd046d55df9f"
source = "git+https://github.com/mozilla/application-services?rev=9054db4bb5031881550ceab3448665ef6499a706#9054db4bb5031881550ceab3448665ef6499a706"
dependencies = [
"anyhow",
"error-support",

Просмотреть файл

@ -208,13 +208,14 @@ warp = { git = "https://github.com/seanmonstar/warp", rev = "9d081461ae1167eb321
malloc_size_of_derive = { path = "xpcom/rust/malloc_size_of_derive" }
# application-services overrides to make updating them all simpler.
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
suggest = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "5fc8ee2f0f6950e36d4096983757bd046d55df9f" }
interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
relevancy = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
sql-support = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
suggest = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
sync15 = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
tabs = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
viaduct = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
webext-storage = { git = "https://github.com/mozilla/application-services", rev = "9054db4bb5031881550ceab3448665ef6499a706" }
# Patch mio 0.8.8 to use windows-sys 0.52 (backport https://github.com/tokio-rs/mio/commit/eea9e3e0c469480e5c59c01e6c3c7e5fd88f0848)
mio_0_8 = { package = "mio", git = "https://github.com/glandium/mio", rev = "9a2ef335c366044ffe73b1c4acabe50a1daefe05" }

1
third_party/rust/relevancy/.cargo-checksum.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"files":{"Cargo.toml":"9cd293889d14141968761c609b8e472c332fc1c0656fff58602fd2993a537f98","build.rs":"a562bfe527d21c4e8a1a44b892defa83cdff141ec5dd51ed6f3862330e50ddd7","src/bin/generate-test-data.rs":"7f1c9dc445418c7627f89d1f2aa8e550d0f85b3d1f05edb7c378ab9441714f1f","src/db.rs":"0b45180f3031759213a0421231b6f109ed4f5c88aca556df159ce2717416cfec","src/error.rs":"6831fc329044174a8451b8b008c0b96c47404c591eb42e880562e65da0adfd0f","src/interest.rs":"ce6298ef8f69fcb57c8e5797467cbe1c0212a0d94daf828b12845740ac14a166","src/lib.rs":"7a0f0ad0a43f371035d9c0b73d143cf1b387d4b8cfad0d0db79314b5b91fd43c","src/populate_interests.rs":"b8905b52f9fc80719c175253b758413f606b27660e660635094421eec8b24c8f","src/relevancy.udl":"a3fae5097f9e8b39bb6c74ed6789906748c46f22d377e3dcb73b08731908f5bc","src/schema.rs":"f782c712f10c4f1af2f9e1424d6b52f59a2bacfcc452a8feb763f36478f5dd5d","src/url_hash.rs":"5619a249d471e7b642d889bad09e93212559c8b947010d49492c1423da2b310e","test-data":"392fc950363c9953ea6ab144b81d84021c4af1e1177cc0adac4eda5688c8bc33"},"package":null}

47
third_party/rust/relevancy/Cargo.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,47 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
name = "relevancy"
version = "0.1.0"
exclude = [
"/android",
"/ios",
]
license = "MPL-2.0"
[lib]
[[bin]]
name = "generate-test-data"
[dependencies]
log = "0.4"
md-5 = "0.10"
parking_lot = ">=0.11,<=0.12"
thiserror = "1.0"
uniffi = "0.25.2"
url = "2.5"
[dependencies.error-support]
path = "../support/error"
[dependencies.rusqlite]
version = "0.30.0"
features = ["bundled"]
[dependencies.sql-support]
path = "../support/sql"
[build-dependencies.uniffi]
version = "0.25.2"
features = ["build"]

8
third_party/rust/relevancy/build.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
fn main() {
uniffi::generate_scaffolding("./src/relevancy.udl").unwrap();
}

43
third_party/rust/relevancy/src/bin/generate-test-data.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,43 @@
use relevancy::{
url_hash::{hash_url, UrlHash},
Interest,
};
use std::{collections::HashMap, fs::File, io::Write};
// Generate a set of test data and output it to the `test-data` file.
//
// This is meant to be a placeholder until we can get this data stored in remote settings.
const TEST_INTEREST_DATA: &[(&str, Interest)] = &[
("https://espn.com/", Interest::Sports),
("https://dogs.com/", Interest::Animals),
("https://cars.com/", Interest::Autos),
("https://www.vouge.com/", Interest::Fashion),
("https://slashdot.org/", Interest::Tech),
("https://www.nascar.com/", Interest::Autos),
("https://www.nascar.com/", Interest::Sports),
];
fn main() {
let mut interest_map: HashMap<Interest, Vec<UrlHash>> =
HashMap::from_iter(Interest::all().into_iter().map(|i| (i, vec![])));
for (url, interest) in TEST_INTEREST_DATA {
if let Some(hash) = hash_url(url) {
interest_map.get_mut(interest).unwrap().push(hash)
}
}
let mut f = File::create("test-data").expect("Error opening file");
// Loop over all possible interests
for interest in Interest::all() {
// Get the list of URL hashes for that interest
let hashes = interest_map.get(&interest).unwrap();
// Write the count
f.write_all(&(hashes.len() as u32).to_le_bytes())
.expect("Error writing file");
// Write the hashes
for hash in hashes {
f.write_all(hash).expect("Error writing file");
}
}
}

118
third_party/rust/relevancy/src/db.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,118 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
use crate::{
schema::RelevancyConnectionInitializer,
url_hash::{hash_url, UrlHash},
Interest, InterestVector, Result,
};
use parking_lot::Mutex;
use rusqlite::{Connection, OpenFlags};
use sql_support::{open_database::open_database_with_flags, ConnExt};
use std::path::Path;
/// A thread-safe wrapper around an SQLite connection to the Relevancy database
pub struct RelevancyDb {
pub conn: Mutex<Connection>,
}
impl RelevancyDb {
pub fn open(path: impl AsRef<Path>) -> Result<Self> {
let conn = open_database_with_flags(
path,
OpenFlags::SQLITE_OPEN_URI
| OpenFlags::SQLITE_OPEN_NO_MUTEX
| OpenFlags::SQLITE_OPEN_CREATE
| OpenFlags::SQLITE_OPEN_READ_WRITE,
&RelevancyConnectionInitializer,
)?;
Ok(Self {
conn: Mutex::new(conn),
})
}
#[cfg(test)]
pub fn open_for_test() -> Self {
use std::sync::atomic::{AtomicU32, Ordering};
static COUNTER: AtomicU32 = AtomicU32::new(0);
let count = COUNTER.fetch_add(1, Ordering::Relaxed);
Self::open(format!("file:test{count}.sqlite?mode=memory&cache=shared")).unwrap()
}
/// Accesses the Suggest database in a transaction for reading.
pub fn read<T>(&self, op: impl FnOnce(&RelevancyDao) -> Result<T>) -> Result<T> {
let mut conn = self.conn.lock();
let tx = conn.transaction()?;
let dao = RelevancyDao::new(&tx);
op(&dao)
}
/// Accesses the Suggest database in a transaction for reading and writing.
pub fn read_write<T>(&self, op: impl FnOnce(&mut RelevancyDao) -> Result<T>) -> Result<T> {
let mut conn = self.conn.lock();
let tx = conn.transaction()?;
let mut dao = RelevancyDao::new(&tx);
let result = op(&mut dao)?;
tx.commit()?;
Ok(result)
}
}
/// A data access object (DAO) that wraps a connection to the Relevancy database
///
/// Methods that only read from the database take an immutable reference to
/// `self` (`&self`), and methods that write to the database take a mutable
/// reference (`&mut self`).
pub struct RelevancyDao<'a> {
pub conn: &'a Connection,
}
impl<'a> RelevancyDao<'a> {
fn new(conn: &'a Connection) -> Self {
Self { conn }
}
/// Associate a URL with an interest
pub fn add_url_interest(&mut self, url_hash: UrlHash, interest: Interest) -> Result<()> {
let sql = "
INSERT OR REPLACE INTO url_interest(url_hash, interest_code)
VALUES (?, ?)
";
self.conn.execute(sql, (url_hash, interest as u32))?;
Ok(())
}
/// Get an interest vector for a URL
pub fn get_url_interest_vector(&self, url: &str) -> Result<InterestVector> {
let hash = match hash_url(url) {
Some(u) => u,
None => return Ok(InterestVector::default()),
};
let mut stmt = self.conn.prepare_cached(
"
SELECT interest_code
FROM url_interest
WHERE url_hash=?
",
)?;
let interests = stmt.query_and_then((hash,), |row| -> Result<Interest> {
Ok(row.get::<_, u32>(0)?.into())
})?;
let mut interest_vec = InterestVector::default();
for interest in interests {
interest_vec[interest?] += 1
}
Ok(interest_vec)
}
/// Do we need to load the interest data?
pub fn need_to_load_url_interests(&self) -> Result<bool> {
// TODO: we probably will need a better check than this.
Ok(self
.conn
.query_one("SELECT NOT EXISTS (SELECT 1 FROM url_interest)")?)
}
}

44
third_party/rust/relevancy/src/error.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,44 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
use error_support::{ErrorHandling, GetErrorHandling};
/// Errors we return via the public interface.
#[derive(Debug, thiserror::Error)]
pub enum RelevancyApiError {
#[error("Unexpected Error: {reason}")]
Unexpected { reason: String },
}
/// Errors we use internally
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Error opening database: {0}")]
OpenDatabase(#[from] sql_support::open_database::Error),
#[error("Sql error: {0}")]
SqlError(#[from] rusqlite::Error),
#[error("Error fetching interest data")]
FetchInterestDataError,
}
/// Result enum for the public API
pub type ApiResult<T> = std::result::Result<T, RelevancyApiError>;
/// Result enum for internal functions
pub type Result<T> = std::result::Result<T, Error>;
// Define how our internal errors are handled and converted to external errors
// See `support/error/README.md` for how this works, especially the warning about PII.
impl GetErrorHandling for Error {
type ExternalError = RelevancyApiError;
fn get_error_handling(&self) -> ErrorHandling<Self::ExternalError> {
ErrorHandling::convert(RelevancyApiError::Unexpected {
reason: self.to_string(),
})
}
}

167
third_party/rust/relevancy/src/interest.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,167 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/// List of possible interests for a domain. Domains can have be associated with one or multiple
/// interests. `Inconclusive` is used for domains in the user's top sites that we can't classify
/// because there's no corresponding entry in the interest database.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u32)]
pub enum Interest {
Animals,
Arts,
Autos,
Business,
Career,
Education,
Fashion,
Finance,
Food,
Government,
Health,
Hobbies,
Home,
News,
RealEstate,
Society,
Sports,
Tech,
Travel,
Inconclusive,
}
impl From<Interest> for u32 {
fn from(interest: Interest) -> Self {
interest as u32
}
}
impl From<Interest> for usize {
fn from(interest: Interest) -> Self {
interest as usize
}
}
impl From<u32> for Interest {
fn from(code: u32) -> Self {
if code as usize > Self::COUNT {
panic!("Invalid interest code: {code}")
}
// Safety: This is safe since Interest has a u32 representation and we've done a bounds
// check
unsafe { std::mem::transmute(code) }
}
}
impl Interest {
const COUNT: usize = 20;
pub fn all() -> [Interest; Self::COUNT] {
[
Self::Animals,
Self::Arts,
Self::Autos,
Self::Business,
Self::Career,
Self::Education,
Self::Fashion,
Self::Finance,
Self::Food,
Self::Government,
Self::Health,
Self::Hobbies,
Self::Home,
Self::News,
Self::RealEstate,
Self::Society,
Self::Sports,
Self::Tech,
Self::Travel,
Self::Inconclusive,
]
}
}
/// Vector storing a count value for each interest
///
/// Here "vector" refers to the mathematical object, not a Rust `Vec`. It always has a fixed
/// number of elements.
#[derive(Debug, Default, PartialEq, Eq)]
pub struct InterestVector {
pub animals: u32,
pub arts: u32,
pub autos: u32,
pub business: u32,
pub career: u32,
pub education: u32,
pub fashion: u32,
pub finance: u32,
pub food: u32,
pub government: u32,
pub health: u32,
pub hobbies: u32,
pub home: u32,
pub news: u32,
pub real_estate: u32,
pub society: u32,
pub sports: u32,
pub tech: u32,
pub travel: u32,
pub inconclusive: u32,
}
impl std::ops::Index<Interest> for InterestVector {
type Output = u32;
fn index(&self, index: Interest) -> &u32 {
match index {
Interest::Animals => &self.animals,
Interest::Arts => &self.arts,
Interest::Autos => &self.autos,
Interest::Business => &self.business,
Interest::Career => &self.career,
Interest::Education => &self.education,
Interest::Fashion => &self.fashion,
Interest::Finance => &self.finance,
Interest::Food => &self.food,
Interest::Government => &self.government,
Interest::Health => &self.health,
Interest::Hobbies => &self.hobbies,
Interest::Home => &self.home,
Interest::News => &self.news,
Interest::RealEstate => &self.real_estate,
Interest::Society => &self.society,
Interest::Sports => &self.sports,
Interest::Tech => &self.tech,
Interest::Travel => &self.travel,
Interest::Inconclusive => &self.inconclusive,
}
}
}
impl std::ops::IndexMut<Interest> for InterestVector {
fn index_mut(&mut self, index: Interest) -> &mut u32 {
match index {
Interest::Animals => &mut self.animals,
Interest::Arts => &mut self.arts,
Interest::Autos => &mut self.autos,
Interest::Business => &mut self.business,
Interest::Career => &mut self.career,
Interest::Education => &mut self.education,
Interest::Fashion => &mut self.fashion,
Interest::Finance => &mut self.finance,
Interest::Food => &mut self.food,
Interest::Government => &mut self.government,
Interest::Health => &mut self.health,
Interest::Hobbies => &mut self.hobbies,
Interest::Home => &mut self.home,
Interest::News => &mut self.news,
Interest::RealEstate => &mut self.real_estate,
Interest::Society => &mut self.society,
Interest::Sports => &mut self.sports,
Interest::Tech => &mut self.tech,
Interest::Travel => &mut self.travel,
Interest::Inconclusive => &mut self.inconclusive,
}
}
}

81
third_party/rust/relevancy/src/lib.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,81 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Proposed API for the relevancy component (validation phase)
//!
//! The goal here is to allow us to validate that we can reliably detect user interests from
//! history data, without spending too much time building the API out. There's some hand-waving
//! towards how we would use this data to rank search results, but we don't need to come to a final
//! decision on that yet.
mod db;
mod error;
mod interest;
mod populate_interests;
mod schema;
pub mod url_hash;
pub use db::RelevancyDb;
pub use error::{ApiResult, Error, RelevancyApiError, Result};
pub use interest::{Interest, InterestVector};
use error_support::handle_error;
pub struct RelevancyStore {
db: RelevancyDb,
}
/// Top-level API for the Relevancy component
impl RelevancyStore {
#[handle_error(Error)]
pub fn new(db_path: String) -> ApiResult<Self> {
Ok(Self {
db: RelevancyDb::open(db_path)?,
})
}
/// Ingest top URLs to build the user's interest vector.
///
/// Consumer should pass a list of the user's top URLs by frecency to this method. It will
/// then:
///
/// - Download the URL interest data from remote settings. Eventually this should be cached /
/// stored in the database, but for now it would be fine to download fresh data each time.
/// - Match the user's top URls against the interest data to build up their interest vector.
/// - Store the user's interest vector in the database.
///
/// This method may execute for a long time and should only be called from a worker thread.
#[handle_error(Error)]
pub fn ingest(&self, _top_urls_by_frecency: Vec<String>) -> ApiResult<()> {
populate_interests::ensure_interest_data_populated(&self.db)?;
todo!()
}
/// Calculate metrics for the validation phase
///
/// This runs after [Self::ingest]. It takes the interest vector that ingest created and
/// calculates a set of metrics that we can report to glean.
#[handle_error(Error)]
pub fn calculate_metrics(&self) -> ApiResult<InterestMetrics> {
todo!()
}
/// Get the user's interest vector directly.
///
/// This runs after [Self::ingest]. It returns the interest vector directly so that the
/// consumer can show it in an `about:` page.
#[handle_error(Error)]
pub fn user_interest_vector(&self) -> ApiResult<InterestVector> {
todo!()
}
}
/// Interest metric data. See `relevancy.udl` for details.
pub struct InterestMetrics {
pub top_single_interest_similarity: u32,
pub top_2interest_similarity: u32,
pub top_3interest_similarity: u32,
}
uniffi::include_scaffolding!("relevancy");

157
third_party/rust/relevancy/src/populate_interests.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,157 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use crate::{url_hash::UrlHash, Error, Interest, RelevancyDb, Result};
use std::io::{Cursor, Read};
pub fn ensure_interest_data_populated(db: &RelevancyDb) -> Result<()> {
if !db.read(|dao| dao.need_to_load_url_interests())? {
return Ok(());
}
let interest_data = match fetch_interest_data() {
Ok(data) => data,
Err(e) => {
log::warn!("error fetching interest data: {e}");
return Err(Error::FetchInterestDataError);
}
};
db.read_write(move |dao| {
for (url_hash, interest) in interest_data {
dao.add_url_interest(url_hash, interest)?;
}
Ok(())
})
}
/// Fetch the interest data
fn fetch_interest_data() -> std::io::Result<Vec<(UrlHash, Interest)>> {
// TODO: this hack should be replaced with something that fetches from remote settings
let bytes = include_bytes!("../test-data");
let mut reader = Cursor::new(&bytes);
let mut data = vec![];
// Loop over all possible interests
for interest in Interest::all() {
// read the count
let mut buf = [0u8; 4];
reader.read_exact(&mut buf)?;
let count = u32::from_le_bytes(buf);
for _ in 0..count {
let mut url_hash: UrlHash = [0u8; 16];
reader.read_exact(&mut url_hash)?;
data.push((url_hash, interest));
}
}
Ok(data)
}
#[cfg(test)]
mod test {
use super::*;
use crate::InterestVector;
#[test]
fn test_interest_vectors() {
let db = RelevancyDb::open_for_test();
ensure_interest_data_populated(&db).unwrap();
db.read(|dao| {
// Test that the interest data matches the values we started from in
// `bin/generate-test-data.rs`
assert_eq!(
dao.get_url_interest_vector("https://espn.com/").unwrap(),
InterestVector {
sports: 1,
..InterestVector::default()
}
);
assert_eq!(
dao.get_url_interest_vector("https://dogs.com/").unwrap(),
InterestVector {
animals: 1,
..InterestVector::default()
}
);
assert_eq!(
dao.get_url_interest_vector("https://cars.com/").unwrap(),
InterestVector {
autos: 1,
..InterestVector::default()
}
);
assert_eq!(
dao.get_url_interest_vector("https://www.vouge.com/")
.unwrap(),
InterestVector {
fashion: 1,
..InterestVector::default()
}
);
assert_eq!(
dao.get_url_interest_vector("https://slashdot.org/")
.unwrap(),
InterestVector {
tech: 1,
..InterestVector::default()
}
);
assert_eq!(
dao.get_url_interest_vector("https://www.nascar.com/")
.unwrap(),
InterestVector {
autos: 1,
sports: 1,
..InterestVector::default()
}
);
assert_eq!(
dao.get_url_interest_vector("https://unknown.url/").unwrap(),
InterestVector::default()
);
Ok(())
})
.unwrap();
}
#[test]
fn test_variations_on_the_url() {
let db = RelevancyDb::open_for_test();
ensure_interest_data_populated(&db).unwrap();
db.read(|dao| {
// Different paths/queries should work
assert_eq!(
dao.get_url_interest_vector("https://espn.com/foo/bar/?baz")
.unwrap(),
InterestVector {
sports: 1,
..InterestVector::default()
}
);
// Different schemes should too
assert_eq!(
dao.get_url_interest_vector("http://espn.com/").unwrap(),
InterestVector {
sports: 1,
..InterestVector::default()
}
);
// But changes to the domain shouldn't
assert_eq!(
dao.get_url_interest_vector("http://www.espn.com/").unwrap(),
InterestVector::default()
);
// However, extra components past the 3rd one in the domain are ignored
assert_eq!(
dao.get_url_interest_vector("https://foo.www.nascar.com/")
.unwrap(),
InterestVector {
autos: 1,
sports: 1,
..InterestVector::default()
}
);
Ok(())
})
.unwrap();
}
}

106
third_party/rust/relevancy/src/relevancy.udl поставляемый Normal file
Просмотреть файл

@ -0,0 +1,106 @@
namespace relevancy { };
[Error]
interface RelevancyApiError {
Unexpected(string reason);
};
// Top-level class for the Relevancy component
interface RelevancyStore {
// Construct a new RelevancyStore
[Throws=RelevancyApiError]
constructor(string dbpath);
// Ingest the top URLs by frequency to build up the user's interest vector
[Throws=RelevancyApiError]
void ingest(sequence<string> top_urls);
// Calculate metrics for the user's interest vector in order to measure how strongly we're
// identifying interests. See the `InterestMetrics` struct for details.
[Throws=RelevancyApiError]
InterestMetrics calculate_metrics();
// Get the interest vector for the user.
//
// This is intended to be show to the user in an `about:` page so that users can judge if it
// feels correct.
[Throws=RelevancyApiError]
InterestVector user_interest_vector();
};
enum Interest {
"Animals",
"Arts",
"Autos",
"Business",
"Career",
"Education",
"Fashion",
"Finance",
"Food",
"Government",
"Health",
"Hobbies",
"Home",
"News",
"RealEstate",
"Society",
"Sports",
"Tech",
"Travel",
"Inconclusive",
};
// Interest metrics that we want to send to Glean as part of the validation process. These contain
// the cosine similarity when comparing the user's interest against various interest vectors that
// consumers may use.
//
// Cosine similary was chosen because it seems easy to calculate. This was then matched against
// some semi-plausible real-world interest vectors that consumers might use. This is all up for
// debate and we may decide to switch to some other metrics.
//
// Similarity values are transformed to integers by multiplying the floating point value by 1000 and
// rounding. This is to make them compatible with Glean's distribution metrics.
dictionary InterestMetrics {
// Similarity between the user's interest vector and an interest vector where the element for
// the user's top interest is copied, but all other interests are set to zero. This measures
// the highest possible similarity with consumers that used interest vectors with a single
// interest set.
u32 top_single_interest_similarity;
// The same as before, but the top 2 interests are copied. This measures the highest possible
// similarity with consumers that used interest vectors with a two interests (note: this means
// they would need to choose the user's top two interests and have the exact same proportion
// between them as the user).
u32 top_2interest_similarity;
// The same as before, but the top 3 interests are copied.
u32 top_3interest_similarity;
};
// Vector storing a count value for each interest
//
// Here "vector" refers to the mathematical object, not a Rust `Vec`. It always has a fixed
// number of elements.
dictionary InterestVector {
u32 animals;
u32 arts;
u32 autos;
u32 business;
u32 career;
u32 education;
u32 fashion;
u32 finance;
u32 food;
u32 government;
u32 health;
u32 hobbies;
u32 home;
u32 news;
u32 real_estate;
u32 society;
u32 sports;
u32 tech;
u32 travel;
u32 inconclusive;
};

53
third_party/rust/relevancy/src/schema.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,53 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
use rusqlite::{Connection, Transaction};
use sql_support::open_database::{self, ConnectionInitializer};
/// The current database schema version.
///
/// For any changes to the schema [`SQL`], please make sure to:
///
/// 1. Bump this version.
/// 2. Add a migration from the old version to the new version in
/// [`RelevancyConnectionInitializer::upgrade_from`].
pub const VERSION: u32 = 13;
/// The current database schema.
pub const SQL: &str = "
CREATE TABLE url_interest(
url_hash BLOB NOT NULL,
interest_code INTEGER NOT NULL,
PRIMARY KEY (url_hash, interest_code)
) WITHOUT ROWID;
";
/// Initializes an SQLite connection to the Relevancy database, performing
/// migrations as needed.
pub struct RelevancyConnectionInitializer;
impl ConnectionInitializer for RelevancyConnectionInitializer {
const NAME: &'static str = "relevancy db";
const END_VERSION: u32 = VERSION;
fn prepare(&self, conn: &Connection, _db_empty: bool) -> open_database::Result<()> {
let initial_pragmas = "
-- Use in-memory storage for TEMP tables.
PRAGMA temp_store = 2;
PRAGMA journal_mode = WAL;
PRAGMA foreign_keys = ON;
";
conn.execute_batch(initial_pragmas)?;
Ok(())
}
fn init(&self, db: &Transaction<'_>) -> open_database::Result<()> {
Ok(db.execute_batch(SQL)?)
}
fn upgrade_from(&self, _db: &Transaction<'_>, version: u32) -> open_database::Result<()> {
Err(open_database::Error::IncompatibleVersion(version))
}
}

63
third_party/rust/relevancy/src/url_hash.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,63 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use md5::{Digest, Md5};
use url::{Host, Url};
pub type UrlHash = [u8; 16];
/// Given a URL, extract the part of it that we want to use to identify it.
///
/// We currently use the final 3 components of the URL domain.
///
/// TODO: decide if this should be 3 or 3 components.
pub fn url_hash_source(url: &str) -> Option<String> {
let url = Url::parse(url).ok()?;
let domain = match url.host() {
Some(Host::Domain(d)) => d,
_ => return None,
};
// This will store indexes of `.` chars as we search backwards.
let mut pos = domain.len();
for _ in 0..3 {
match domain[0..pos].rfind('.') {
Some(p) => pos = p,
// The domain has less than 3 dots, return it all
None => return Some(domain.to_owned()),
}
}
Some(domain[pos + 1..].to_owned())
}
pub fn hash_url(url: &str) -> Option<UrlHash> {
url_hash_source(url).map(|hash_source| {
let mut hasher = Md5::new();
hasher.update(hash_source);
let result = hasher.finalize();
result.into()
})
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_url_hash_source() {
let table = [
("http://example.com/some-path", Some("example.com")),
("http://foo.example.com/some-path", Some("foo.example.com")),
(
"http://foo.bar.baz.example.com/some-path",
Some("baz.example.com"),
),
("http://foo.com.uk/some-path", Some("foo.com.uk")),
("http://amazon.com/some-path", Some("amazon.com")),
("http://192.168.0.1/some-path", None),
];
for (url, expected) in table {
assert_eq!(url_hash_source(url).as_deref(), expected)
}
}
}

Двоичные данные
third_party/rust/relevancy/test-data поставляемый Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"812811e5a8e00abe3ec345cd8fd435e27fec7cb8f2e45a0e93e5becf564c46ad","src/conn_ext.rs":"e48e862e47c000c545dcc766fc1889498a8709bee00e240ed68d247b0fbef577","src/debug_tools.rs":"bece2bc3d35379b81ea2f942a0a3e909e0ab0553656505904745548eacaf402a","src/each_chunk.rs":"8aaba842e43b002fbc0fee95d14ce08faa7187b1979c765b2e270cd4802607a5","src/lib.rs":"af704ec04beb6c2c388d4566710e1167b18fb64acb248ccf37a67679daffddb6","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"40ad2da7d5559f0e5180e35d403c307ce230fe9d0d2a3fec7c9481ce13acda64","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null}
{"files":{"Cargo.toml":"812811e5a8e00abe3ec345cd8fd435e27fec7cb8f2e45a0e93e5becf564c46ad","src/conn_ext.rs":"e48e862e47c000c545dcc766fc1889498a8709bee00e240ed68d247b0fbef577","src/debug_tools.rs":"bece2bc3d35379b81ea2f942a0a3e909e0ab0553656505904745548eacaf402a","src/each_chunk.rs":"8aaba842e43b002fbc0fee95d14ce08faa7187b1979c765b2e270cd4802607a5","src/lib.rs":"af704ec04beb6c2c388d4566710e1167b18fb64acb248ccf37a67679daffddb6","src/maybe_cached.rs":"0b18425595055883a98807fbd62ff27a79c18af34e7cb3439f8c3438463ef2dd","src/open_database.rs":"ba290bfb39468e96f9b3ea865e0c13c2cc5a731ea8877a9feb6b1de4f7d666c4","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null}

Просмотреть файл

@ -278,6 +278,9 @@ pub mod test_utils {
}
}
/// Attempt to run all upgrades up to a specific version.
///
/// This will result in a panic if an upgrade fails to run.
pub fn upgrade_to(&self, version: u32) {
let mut conn = self.open();
let tx = conn.transaction().unwrap();
@ -293,6 +296,9 @@ pub mod test_utils {
tx.commit().unwrap();
}
/// Attempt to run all upgrades
///
/// This will result in a panic if an upgrade fails to run.
pub fn run_all_upgrades(&self) {
let current_version = get_schema_version(&self.open()).unwrap();
for version in current_version..CI::END_VERSION {

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"4aa81cff67e67b08ba3348c1acddaa5aee887df3c35006754c9cda4273a94458","README.md":"8d7457893194e255b87e5a2667ee25c87bd470f5338d7078506f866a67a3fdbd","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/config.rs":"03630b2219b6674e332a1f96f44db74def17f985c850a800299b815fa72241c2","src/db.rs":"d373ad097edac2bbcc6e1b14f51c21b6e2cab2289d27667332798c9cde4dcbef","src/error.rs":"f563210a6c050d98ec85e0f6d9401e7373bfb816e865e8edabbabb23d848ba13","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"65a035dbfb17e2d2d9f237ad52dc03982ae28c70e3dcf3d96cc9f2d7af79efe3","src/pocket.rs":"c4dda43390d1c39dc795933596b3c1e4e282932cac6c69da53c6e05d39e9ef29","src/provider.rs":"4fe662587efc5a80d000c217ce124506c6800293c50ff460ef95e9e659c764b9","src/rs.rs":"0910368f9e7c4703b00d0de86902d647d70c1f75a256fbeb2126c91f0499a083","src/schema.rs":"8fad4cc624f48946676adbc3de7d061f05fe82531523008f417d6130a2132e34","src/store.rs":"a869971d5593bec2dd40822ba63d0e5a5def96a870ff5a7c33afbcbf5869946b","src/suggest.udl":"d941662596d48793d1570e5b8432b7fd7b4fb1b4550fb38d4e14224fcf4195bc","src/suggestion.rs":"7ee407949f40d88e5d3d4c0da400b987e85ace9f34c648f010cd7f5f2aba0506","src/yelp.rs":"37e77900c12c68cca292a84c6dd6c67d16628c68f4612d8d9bedb1bddf985229","uniffi.toml":"f26317442ddb5b3281245bef6e60ffcb78bb95d29fe4a351a56dbb88d4ec8aab"},"package":null}
{"files":{"Cargo.toml":"4aa81cff67e67b08ba3348c1acddaa5aee887df3c35006754c9cda4273a94458","README.md":"fb72d0028586cab1421b853ef529d7ce78ad7316818b7733a4f3488b0fba67f7","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/config.rs":"206ae9dc768c755649cb0c88a7b1fc3c926c715441784f61e9dc06a8a02fc568","src/db.rs":"b88f2162d4d43efa52b254b6c1e766dbf9715c40d47f94b321d7b2bbba69d39e","src/error.rs":"f563210a6c050d98ec85e0f6d9401e7373bfb816e865e8edabbabb23d848ba13","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"65a035dbfb17e2d2d9f237ad52dc03982ae28c70e3dcf3d96cc9f2d7af79efe3","src/pocket.rs":"1316668840ec9b4ea886223921dc9d3b5a1731d1a5206c0b1089f2a6c45c1b7b","src/provider.rs":"fe76f19a223f5cac056c7d48525087ca2c26bf0629b0e11b1f8dc98d165c8bb2","src/rs.rs":"7f9136b5cc6f5617a391e0abd5637f9cc63c50fb206f787fd7b92f39b7bbfb5d","src/schema.rs":"d9aba13d9e299819eda88ba3cba6971ec54f555c37ab7589689891531e1390c8","src/store.rs":"8505c51320aea5cb292df8cf8bc4f096e67a3603860f8575e681e630212a0248","src/suggest.udl":"288cef097b74426128b900dcf2d74f09868b88831f0cec4ecefbb5f9e8acf01f","src/suggestion.rs":"477736d6bc3e25c0fccf3e2e69e12882a10db1c57455ee7dca149443b59e0c3b","src/yelp.rs":"9c0dc02a994cc05df524aa4ef337d10f575d1891259193b6419fed6fe279cb54","uniffi.toml":"f26317442ddb5b3281245bef6e60ffcb78bb95d29fe4a351a56dbb88d4ec8aab"},"package":null}

110
third_party/rust/suggest/README.md поставляемый
Просмотреть файл

@ -1,7 +1,111 @@
# Suggest
The **Suggest Rust component** powers the [Firefox Suggest](https://support.mozilla.org/en-US/kb/firefox-suggest-faq) feature.
The **Suggest Rust component** provides address bar search suggestions from Mozilla. This includes suggestions from sponsors, as well as non-sponsored suggestions for other web destinations. These suggestions are part of the [Firefox Suggest](https://support.mozilla.org/en-US/kb/firefox-suggest-faq) feature.
This component currently supports the basic Suggest experience only. The basic experience shows suggestions for sponsored and web content from a canned dataset. The component downloads the dataset from [Remote Settings](https://remote-settings.readthedocs.io/en/latest/), stores the suggestions in a local database, and makes them available to the Firefox address bar. Because matching is done locally, Mozilla never sees the user's query.
This component is integrated into Firefox Desktop, Android, and iOS.
The opt-in "Improved Firefox Suggest Experience", which sends user queries to a [Mozilla-owned proxy server](https://mozilla-services.github.io/merino/intro.html) for server-side matching, is not currently supported.
## Architecture
Search suggestions from Mozilla are stored in a [Remote Settings](https://remote-settings.readthedocs.io/en/latest/) collection. The Suggest component downloads these suggestions from Remote Settings, stores them in a local SQLite database, and makes them available to the Firefox address bar. Because these suggestions are stored and matched locally, Mozilla never sees the user's search queries.
This component follows the architecture of the other [Application Services Rust components](https://mozilla.github.io/application-services/book/index.html): a cross-platform Rust core, and platform-specific bindings for Firefox Desktop, Android, and iOS. These bindings are generated automatically using the [UniFFI](https://mozilla.github.io/uniffi-rs/) tool.
### For consumers
This section is for application developers. It describes how Firefox Desktop, Android, and iOS consume the Suggest Rust component.
The cornerstone of the component is the `SuggestStore` interface, which is the **store**. The store _ingests_ (downloads and persists) suggestions from Remote Settings, and returns matching suggestions as the user types. This is the main interface that applications use to interact with the component.
While the store provides most of the functionality, the application has a few responsibilities:
**1. Create and manage a `SuggestStore` as a singleton.** Under the hood, the store holds multiple connections to the database: a read-write connection for ingestion, and a read-only connection for queries. The store uses the right connection for each operation, so applications shouldn't create multiple stores. The application is responsible for specifying the correct platform-specific storage directory for the database. The database contains _cached data_, like suggestions, and _user data_, like which suggestions have been dismissed. For this reason, applications should persist the database in their durable storage or "profile" directory. Applications specify the storage directory, and create a store, using the `SuggestStoreBuilder` interface.
**2. Periodically call the store's `ingest()` method to ingest new suggestions.** While the store takes care of efficiently downloading and persisting suggestions from Remote Settings, the application is still responsible for scheduling this work. This is because the Suggest component doesn't have access to the various platform-specific background work scheduling mechanisms, like `nsIUpdateTimerManager` on Desktop, `WorkManager` on Android, or `BGTaskScheduler` on iOS. These are three different APIs with different constraints, written in three different languages. Instead of trying to bind to these different mechanisms, the component leaves it up to the application to use the right one on each platform. Ingestion is network- and disk I/O-bound, and should be done in the background.
**3. Use the store's `query()` and `interrupt()` methods to query for fresh suggestions as the user types.** The application passes the user's input, and additional options like which suggestion types to return, to `query()`. Querying the database is disk I/O-bound, so applications should use their respective platforms' facilities for asynchronous work—Kotlin coroutines on Android, and Swift actors on iOS; the UniFFI bindings for Desktop take care of dispatching work to a background thread pool—to avoid blocking the main thread. Running `query()` off-main-thread also lets applications `interrupt()` those queries from the main thread when the user's input changes. This avoids waiting for a query to return suggestions that are now stale.
### For contributors
This section is a primer for engineers contributing code to the Suggest Rust component.
`suggest.udl` describes the component's interface for foreign language consumers. UniFFI uses this file to generate the language bindings for each platform. If you're adding a new suggestion type, you'll want to update the declarations of `Suggestion` and `SuggestionProvider` in this file, as well as the definitions of those types in `suggestion.rs` and `provider.rs`, respectively.
`store.rs` contains the implementation of `SuggestStore` and most of the Suggest component's tests.
`schema.rs` manages the database schema. **Remember to bump the schema version and add a migration whenever you change the schema.**
`db.rs` interacts with the Suggest database. The `SuggestDao` type in this file is a ["data access object"](https://en.wikipedia.org/wiki/Data_access_object) (DAO) that contains all the SQL statements for querying and updating the SQLite database. By convention, `SuggestDao` methods that can write to the database take `&mut self`, and methods that only read take `&self`. The `SuggestDb::read()` and `SuggestDb::write()` methods take a closure that receives either `&SuggestDao` or `&mut SuggestDao`; this is how the DAO enforces that all writes are done in a transaction. If you're curious to learn about how we use SQLite, or you're diagnosing a slow query or adding a new suggestion type, you'll almost certainly want to look at this file.
`rs.rs` defines all the Remote Settings [record](https://docs.kinto-storage.org/en/stable/concepts.html#buckets-collections-and-records) and [attachment](https://docs.kinto-storage.org/en/stable/faq.html#can-i-store-files-inside-kinto) types. The records in the `quicksuggest` Remote Settings collection don't store the suggestions themselves. Instead, each record has a type, and a pointer to a JSON attachment that contains multiple suggestions of that type. This file defines [Serde](https://serde.rs/)-compatible types for all these records and attachments.
`errors.rs` contains all the errors that this component returns. We use the crate-internal `Error` type for all fallible operations within the component, and the public `SuggestApiError` type for errors that applications should handle.
There are other suggestion provider-specific files, like `yelp.rs`, `pocket.rs`, and `keyword.rs`, that aren't covered in this primer. If you're new to the component, we recommend starting with the highest-level interface in `store.rs` first, and jumping to the other files and types as you encounter them in the code.
## Documentation
Each Rust file contains [inline documentation](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html) for types, traits, functions, and methods.
Documentation for `pub` symbols is written with application developers in mind: even if you're a Desktop, Android or iOS developer, the Rust documentation is meant to give you an understanding of how the Gecko, Kotlin and Swift bindings work.
You can see the documentation for all public symbols by running from the command line:
```shell
cargo doc --open
```
By convention, symbols that are exported as part of the component's foreign language interface have `pub` visibility, and symbols that are only used within the component have `pub(crate)` or private visibility. As an exception to this convention, symbols with [doctests](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html) are also `pub`, because doctests [can only link against public symbols](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#include-items-only-when-collecting-doctests).
If you're working on the component, you can see the documentation for `pub(crate)` and private symbols using:
```shell
cargo doc --document-private-items --open
```
💡 If you're adding a new suggestion type, the documentation for the `rs` module is a great place to start.
Please help us keep our documentation useful for everyone, and feel free to file bugs for anything that looks unclear or out-of-date!
## Tests
We use a technique called ["snapshot testing"](https://notlaura.com/what-is-a-snapshot-test/) with the [`expect-test`](https://docs.rs/expect-test/latest/expect_test/) crate for the Suggest component's tests. This technique makes it easier to compare and update all the expected outputs when adding, removing, and changing suggestion types.
The snapshot tests in `store.rs` look like this:
```rs
expect![["{expected-output}"]].assert_debug_eq(&actual_output);
```
The `expect-test` crate generates the `{expected-output}` string, and can update it automatically. If you add, remove, or change a suggestion type, or update the schema, and run `cargo test`, you'll likely see a few failures. `expect-test` will print a readable diff in the `cargo test` output, which you can audit for accuracy.
If the diff looks good, you can update the expectations in-place from the command line using:
```shell
env UPDATE_EXPECT=1 cargo test
```
Most of the tests in `store.rs` are integration-style tests that use a fake Remote Settings interface.
## ⚠️ Breaking Changes ⚠️
A "breaking change" is any code change that breaks the build, tests, or behavior of a consuming application.
These are some common changes that can break consumers:
* **Changing the signature of a method or function that's currently in use.** Adding, removing, or changing the type of an argument or a return value, or reordering arguments, is a breaking change on Desktop, Android, and iOS.
* **Removing or renaming a method, function, or type that's currently in use.**
* **Adding or removing a `[Throws]` attribute**. Changing a non-throwing function to throw an error, or vice versa, is a build breaking change on iOS. On Desktop and Android, changing a non-throwing function to a throwing function won't break the build, but can cause crashes if the consumer doesn't handle the new error.
* **Changing the fields of a dictionary or an enum.** Adding, removing, reordering, or changing the type of a dictionary or an `[Enum]` interface field is a guaranteed build breaking change on iOS. It may be a breaking change on Desktop and Android if the consumer creates new instances of the dictionary or enum.
When working on the Suggest component, this means:
* Adding a new suggestion type is generally _not_ breaking.
* Adding a new method to `SuggestStore` is _not_ breaking.
* Renaming or removing a `SuggestStore` method that's currently in use _is_ breaking.
* Adding a new field to an existing suggestion type _is_ breaking.
If you need to make a breaking change, don't panic! We have a [process for landing them in Application Services](https://mozilla.github.io/application-services/book/howtos/breaking-changes.html), and you can use a [branch build](https://mozilla.github.io/application-services/book/howtos/branch-builds.html) to verify that Android and iOS build and run their tests with your change.
## Bugs
We use Bugzilla to track bugs and feature work. You can use [this link](https://bugzilla.mozilla.org/enter_bug.cgi?product=Application+Services&component=Suggest) to file bugs in the `Application Services :: Suggest` bug component.

5
third_party/rust/suggest/src/config.rs поставляемый
Просмотреть файл

@ -1,3 +1,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
use serde::{Deserialize, Serialize};
use crate::rs::{DownloadedGlobalConfig, DownloadedWeatherData};

265
third_party/rust/suggest/src/db.rs поставляемый
Просмотреть файл

@ -25,15 +25,15 @@ use crate::{
DownloadedMdnSuggestion, DownloadedPocketSuggestion, DownloadedWeatherData,
SuggestRecordId,
},
schema::{SuggestConnectionInitializer, VERSION},
schema::{clear_database, SuggestConnectionInitializer, VERSION},
store::{UnparsableRecord, UnparsableRecords},
suggestion::{cook_raw_suggestion_url, AmpSuggestionType, Suggestion},
Result, SuggestionQuery,
};
/// The metadata key whose value is the timestamp of the last record ingested
/// from the Suggest Remote Settings collection.
pub const LAST_INGEST_META_KEY: &str = "last_quicksuggest_ingest";
/// The metadata key prefix for the last ingested unparsable record. These are
/// records that were not parsed properly, or were not of the "approved" types.
pub const LAST_INGEST_META_UNPARSABLE: &str = "last_quicksuggest_ingest_unparsable";
/// The metadata key whose value keeps track of records of suggestions
/// that aren't parsable and which schema version it was first seen in.
pub const UNPARSABLE_RECORDS_META_KEY: &str = "unparsable_records";
@ -148,20 +148,28 @@ impl<'a> SuggestDao<'a> {
self.put_unparsable_record_id(&record_id)?;
// Advance the last fetch time, so that we can resume
// fetching after this record if we're interrupted.
self.put_last_ingest_if_newer(record.last_modified)
self.put_last_ingest_if_newer(LAST_INGEST_META_UNPARSABLE, record.last_modified)
}
pub fn handle_ingested_record(&mut self, record: &RemoteSettingsRecord) -> Result<()> {
pub fn handle_ingested_record(
&mut self,
last_ingest_key: &str,
record: &RemoteSettingsRecord,
) -> Result<()> {
let record_id = SuggestRecordId::from(&record.id);
// Remove this record's ID from the list of unparsable
// records, since we understand it now.
self.drop_unparsable_record_id(&record_id)?;
// Advance the last fetch time, so that we can resume
// fetching after this record if we're interrupted.
self.put_last_ingest_if_newer(record.last_modified)
self.put_last_ingest_if_newer(last_ingest_key, record.last_modified)
}
pub fn handle_deleted_record(&mut self, record: &RemoteSettingsRecord) -> Result<()> {
pub fn handle_deleted_record(
&mut self,
last_ingest_key: &str,
record: &RemoteSettingsRecord,
) -> Result<()> {
let record_id = SuggestRecordId::from(&record.id);
// Drop either the icon or suggestions, records only contain one or the other
match record_id.as_icon_id() {
@ -173,7 +181,7 @@ impl<'a> SuggestDao<'a> {
self.drop_unparsable_record_id(&record_id)?;
// Advance the last fetch time, so that we can resume
// fetching after this record if we're interrupted.
self.put_last_ingest_if_newer(record.last_modified)
self.put_last_ingest_if_newer(last_ingest_key, record.last_modified)
}
// =============== Low level API ===============
@ -231,12 +239,16 @@ impl<'a> SuggestDao<'a> {
s.title,
s.url,
s.provider,
s.score
s.score,
fk.full_keyword
FROM
suggestions s
JOIN
keywords k
ON k.suggestion_id = s.id
LEFT JOIN
full_keywords fk
ON k.full_keyword_id = fk.id
WHERE
s.provider = :provider
AND k.keyword = :keyword
@ -248,8 +260,9 @@ impl<'a> SuggestDao<'a> {
|row| -> Result<Suggestion> {
let suggestion_id: i64 = row.get("id")?;
let title = row.get("title")?;
let raw_url = row.get::<_, String>("url")?;
let score = row.get::<_, f64>("score")?;
let raw_url: String = row.get("url")?;
let score: f64 = row.get("score")?;
let full_keyword_from_db: Option<String> = row.get("full_keyword")?;
let keywords: Vec<String> = self.conn.query_rows_and_then_cached(
r#"
@ -277,9 +290,12 @@ impl<'a> SuggestDao<'a> {
amp.iab_category,
amp.impression_url,
amp.click_url,
(SELECT i.data FROM icons i WHERE i.id = amp.icon_id) AS icon
i.data AS icon,
i.mimetype AS icon_mimetype
FROM
amp_custom_details amp
LEFT JOIN
icons i ON amp.icon_id = i.id
WHERE
amp.suggestion_id = :suggestion_id
"#,
@ -298,8 +314,10 @@ impl<'a> SuggestDao<'a> {
title,
url: cooked_url,
raw_url,
full_keyword: full_keyword(keyword_lowercased, &keywords),
full_keyword: full_keyword_from_db
.unwrap_or_else(|| full_keyword(keyword_lowercased, &keywords)),
icon: row.get("icon")?,
icon_mimetype: row.get("icon_mimetype")?,
impression_url: row.get("impression_url")?,
click_url: cooked_click_url,
raw_click_url,
@ -350,36 +368,51 @@ impl<'a> SuggestDao<'a> {
},
|row| row.get(0),
)?;
let icon = self.conn.try_query_one(
"SELECT i.data
let (icon, icon_mimetype) = self
.conn
.try_query_row(
"SELECT i.data, i.mimetype
FROM icons i
JOIN wikipedia_custom_details s ON s.icon_id = i.id
WHERE s.suggestion_id = :suggestion_id",
named_params! {
":suggestion_id": suggestion_id
},
true,
)?;
WHERE s.suggestion_id = :suggestion_id
LIMIT 1",
named_params! {
":suggestion_id": suggestion_id
},
|row| -> Result<_> {
Ok((
row.get::<_, Option<Vec<u8>>>(0)?,
row.get::<_, Option<String>>(1)?,
))
},
true,
)?
.unwrap_or((None, None));
Ok(Suggestion::Wikipedia {
title,
url: raw_url,
full_keyword: full_keyword(keyword_lowercased, &keywords),
icon,
icon_mimetype,
})
},
)?;
Ok(suggestions)
}
/// Fetches Suggestions of type Amo provider that match the given query
pub fn fetch_amo_suggestions(&self, query: &SuggestionQuery) -> Result<Vec<Suggestion>> {
/// Query for suggestions using the keyword prefix and provider
fn map_prefix_keywords<T>(
&self,
query: &SuggestionQuery,
provider: &SuggestionProvider,
mut mapper: impl FnMut(&rusqlite::Row, &str) -> Result<T>,
) -> Result<Vec<T>> {
let keyword_lowercased = &query.keyword.to_lowercase();
let (keyword_prefix, keyword_suffix) = split_keyword(keyword_lowercased);
let suggestions_limit = &query.limit.unwrap_or(-1);
let suggestions = self
.conn
.query_rows_and_then_cached(
r#"
let suggestions_limit = query.limit.unwrap_or(-1);
self.conn.query_rows_and_then_cached(
r#"
SELECT
s.id,
MAX(k.rank) AS rank,
@ -405,13 +438,23 @@ impl<'a> SuggestDao<'a> {
LIMIT
:suggestions_limit
"#,
named_params! {
":keyword_prefix": keyword_prefix,
":keyword_suffix": keyword_suffix,
":provider": SuggestionProvider::Amo,
":suggestions_limit": suggestions_limit,
},
|row| -> Result<Option<Suggestion>> {
&[
(":keyword_prefix", &keyword_prefix as &dyn ToSql),
(":keyword_suffix", &keyword_suffix as &dyn ToSql),
(":provider", provider as &dyn ToSql),
(":suggestions_limit", &suggestions_limit as &dyn ToSql),
],
|row| mapper(row, keyword_suffix),
)
}
/// Fetches Suggestions of type Amo provider that match the given query
pub fn fetch_amo_suggestions(&self, query: &SuggestionQuery) -> Result<Vec<Suggestion>> {
let suggestions = self
.map_prefix_keywords(
query,
&SuggestionProvider::Amo,
|row, keyword_suffix| -> Result<Option<Suggestion>> {
let suggestion_id: i64 = row.get("id")?;
let title = row.get("title")?;
let raw_url = row.get::<_, String>("url")?;
@ -534,45 +577,11 @@ impl<'a> SuggestDao<'a> {
/// Fetches suggestions for MDN
pub fn fetch_mdn_suggestions(&self, query: &SuggestionQuery) -> Result<Vec<Suggestion>> {
let keyword_lowercased = &query.keyword.to_lowercase();
let (keyword_prefix, keyword_suffix) = split_keyword(keyword_lowercased);
let suggestions_limit = &query.limit.unwrap_or(-1);
let suggestions = self
.conn
.query_rows_and_then_cached(
r#"
SELECT
s.id,
MAX(k.rank) AS rank,
s.title,
s.url,
s.provider,
s.score,
k.keyword_suffix
FROM
suggestions s
JOIN
prefix_keywords k
ON k.suggestion_id = s.id
WHERE
k.keyword_prefix = :keyword_prefix
AND (k.keyword_suffix BETWEEN :keyword_suffix AND :keyword_suffix || x'FFFF')
AND s.provider = :provider
GROUP BY
s.id
ORDER BY
s.score DESC,
rank DESC
LIMIT
:suggestions_limit
"#,
named_params! {
":keyword_prefix": keyword_prefix,
":keyword_suffix": keyword_suffix,
":provider": SuggestionProvider::Mdn,
":suggestions_limit": suggestions_limit,
},
|row| -> Result<Option<Suggestion>> {
.map_prefix_keywords(
query,
&SuggestionProvider::Mdn,
|row, keyword_suffix| -> Result<Option<Suggestion>> {
let suggestion_id: i64 = row.get("id")?;
let title = row.get("title")?;
let raw_url = row.get::<_, String>("url")?;
@ -829,22 +838,35 @@ impl<'a> SuggestDao<'a> {
)?;
}
}
for (index, keyword) in common_details.keywords.iter().enumerate() {
let mut full_keyword_inserter = FullKeywordInserter::new(self.conn, suggestion_id);
for keyword in common_details.keywords() {
let full_keyword_id = match (suggestion, keyword.full_keyword) {
// Try to associate full keyword data. Only do this for AMP, we decided to
// skip it for Wikipedia in https://bugzilla.mozilla.org/show_bug.cgi?id=1876217
(DownloadedAmpWikipediaSuggestion::Amp(_), Some(full_keyword)) => {
Some(full_keyword_inserter.maybe_insert(full_keyword)?)
}
_ => None,
};
self.conn.execute(
"INSERT INTO keywords(
keyword,
suggestion_id,
full_keyword_id,
rank
)
VALUES(
:keyword,
:suggestion_id,
:full_keyword_id,
:rank
)",
named_params! {
":keyword": keyword,
":rank": index,
":keyword": keyword.keyword,
":rank": keyword.rank,
":suggestion_id": suggestion_id,
":full_keyword_id": full_keyword_id,
},
)?;
}
@ -920,21 +942,29 @@ impl<'a> SuggestDao<'a> {
},
)?;
for (index, keyword) in common_details.keywords.iter().enumerate() {
let mut full_keyword_inserter = FullKeywordInserter::new(self.conn, suggestion_id);
for keyword in common_details.keywords() {
let full_keyword_id = keyword
.full_keyword
.map(|full_keyword| full_keyword_inserter.maybe_insert(full_keyword))
.transpose()?;
self.conn.execute(
"INSERT INTO keywords(
keyword,
suggestion_id,
full_keyword_id,
rank
)
VALUES(
:keyword,
:suggestion_id,
:full_keyword_id,
:rank
)",
named_params! {
":keyword": keyword,
":rank": index,
":keyword": keyword.keyword,
":rank": keyword.rank,
":full_keyword_id": full_keyword_id,
":suggestion_id": suggestion_id,
},
)?;
@ -1141,19 +1171,22 @@ impl<'a> SuggestDao<'a> {
}
/// Inserts or replaces an icon for a suggestion into the database.
pub fn put_icon(&mut self, icon_id: &str, data: &[u8]) -> Result<()> {
pub fn put_icon(&mut self, icon_id: &str, data: &[u8], mimetype: &str) -> Result<()> {
self.conn.execute(
"INSERT OR REPLACE INTO icons(
id,
data
data,
mimetype
)
VALUES(
:id,
:data
:data,
:mimetype
)",
named_params! {
":id": icon_id,
":data": data,
":mimetype": mimetype,
},
)?;
Ok(())
@ -1196,12 +1229,7 @@ impl<'a> SuggestDao<'a> {
/// Clears the database, removing all suggestions, icons, and metadata.
pub fn clear(&mut self) -> Result<()> {
self.conn.execute_batch(
"DELETE FROM suggestions;
DELETE FROM icons;
DELETE FROM meta;",
)?;
Ok(())
Ok(clear_database(self.conn)?)
}
/// Returns the value associated with a metadata key.
@ -1224,12 +1252,14 @@ impl<'a> SuggestDao<'a> {
/// Updates the last ingest timestamp if the given last modified time is
/// newer than the existing one recorded.
pub fn put_last_ingest_if_newer(&mut self, record_last_modified: u64) -> Result<()> {
let last_ingest = self
.get_meta::<u64>(LAST_INGEST_META_KEY)?
.unwrap_or_default();
pub fn put_last_ingest_if_newer(
&mut self,
last_ingest_key: &str,
record_last_modified: u64,
) -> Result<()> {
let last_ingest = self.get_meta::<u64>(last_ingest_key)?.unwrap_or_default();
if record_last_modified > last_ingest {
self.put_meta(LAST_INGEST_META_KEY, record_last_modified)?;
self.put_meta(last_ingest_key, record_last_modified)?;
}
Ok(())
@ -1310,6 +1340,53 @@ impl<'a> SuggestDao<'a> {
}
}
/// Helper struct to get full_keyword_ids for a suggestion
///
/// `FullKeywordInserter` handles repeated full keywords efficiently. The first instance will
/// cause a row to be inserted into the database. Subsequent instances will return the same
/// full_keyword_id.
struct FullKeywordInserter<'a> {
conn: &'a Connection,
suggestion_id: i64,
last_inserted: Option<(&'a str, i64)>,
}
impl<'a> FullKeywordInserter<'a> {
fn new(conn: &'a Connection, suggestion_id: i64) -> Self {
Self {
conn,
suggestion_id,
last_inserted: None,
}
}
fn maybe_insert(&mut self, full_keyword: &'a str) -> rusqlite::Result<i64> {
match self.last_inserted {
Some((s, id)) if s == full_keyword => Ok(id),
_ => {
let full_keyword_id = self.conn.query_row_and_then(
"INSERT INTO full_keywords(
suggestion_id,
full_keyword
)
VALUES(
:suggestion_id,
:keyword
)
RETURNING id",
named_params! {
":keyword": full_keyword,
":suggestion_id": self.suggestion_id,
},
|row| row.get(0),
)?;
self.last_inserted = Some((full_keyword, full_keyword_id));
Ok(full_keyword_id)
}
}
}
}
fn provider_config_meta_key(provider: SuggestionProvider) -> String {
format!("{}{}", PROVIDER_CONFIG_META_KEY_PREFIX, provider as u8)
}

2
third_party/rust/suggest/src/pocket.rs поставляемый
Просмотреть файл

@ -12,7 +12,7 @@ use rusqlite::{Result as RusqliteResult, ToSql};
/// substring for the suffix.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[repr(u8)]
pub enum KeywordConfidence {
pub(crate) enum KeywordConfidence {
Low = 0,
High = 1,
}

48
third_party/rust/suggest/src/provider.rs поставляемый
Просмотреть файл

@ -8,6 +8,8 @@ use rusqlite::{
Result as RusqliteResult,
};
use crate::rs::SuggestRecordType;
/// A provider is a source of search suggestions.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
#[repr(u8)]
@ -46,6 +48,52 @@ impl SuggestionProvider {
_ => None,
}
}
pub(crate) fn records_for_provider(&self) -> Vec<SuggestRecordType> {
match self {
SuggestionProvider::Amp => {
vec![
SuggestRecordType::AmpWikipedia,
SuggestRecordType::Icon,
SuggestRecordType::GlobalConfig,
]
}
SuggestionProvider::Wikipedia => {
vec![
SuggestRecordType::AmpWikipedia,
SuggestRecordType::Icon,
SuggestRecordType::GlobalConfig,
]
}
SuggestionProvider::Amo => {
vec![SuggestRecordType::Amo, SuggestRecordType::GlobalConfig]
}
SuggestionProvider::Pocket => {
vec![SuggestRecordType::Pocket, SuggestRecordType::GlobalConfig]
}
SuggestionProvider::Yelp => {
vec![
SuggestRecordType::Yelp,
SuggestRecordType::Icon,
SuggestRecordType::GlobalConfig,
]
}
SuggestionProvider::Mdn => {
vec![SuggestRecordType::Mdn, SuggestRecordType::GlobalConfig]
}
SuggestionProvider::Weather => {
vec![SuggestRecordType::Weather, SuggestRecordType::GlobalConfig]
}
SuggestionProvider::AmpMobile => {
vec![
SuggestRecordType::AmpMobile,
SuggestRecordType::AmpWikipedia,
SuggestRecordType::Icon,
SuggestRecordType::GlobalConfig,
]
}
}
}
}
impl ToSql for SuggestionProvider {

223
third_party/rust/suggest/src/rs.rs поставляемый
Просмотреть файл

@ -31,7 +31,7 @@
//! the new suggestion in their results, and return `Suggestion::T` variants
//! as needed.
use std::borrow::Cow;
use std::{borrow::Cow, fmt};
use remote_settings::{GetItemsOptions, RemoteSettingsResponse};
use serde::{Deserialize, Deserializer};
@ -47,6 +47,20 @@ pub(crate) const REMOTE_SETTINGS_COLLECTION: &str = "quicksuggest";
/// `mozilla-services/quicksuggest-rs` repo.
pub(crate) const SUGGESTIONS_PER_ATTACHMENT: u64 = 200;
/// A list of default record types to download if nothing is specified.
/// This currently defaults to all of the record types.
pub(crate) const DEFAULT_RECORDS_TYPES: [SuggestRecordType; 9] = [
SuggestRecordType::Icon,
SuggestRecordType::AmpWikipedia,
SuggestRecordType::Amo,
SuggestRecordType::Pocket,
SuggestRecordType::Yelp,
SuggestRecordType::Mdn,
SuggestRecordType::Weather,
SuggestRecordType::GlobalConfig,
SuggestRecordType::AmpMobile,
];
/// A trait for a client that downloads suggestions from Remote Settings.
///
/// This trait lets tests use a mock client.
@ -102,6 +116,61 @@ pub(crate) enum SuggestRecord {
AmpMobile,
}
/// Enum for the different record types that can be consumed.
/// Extracting this from the serialization enum so that we can
/// extend it to get type metadata.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord)]
pub enum SuggestRecordType {
Icon,
AmpWikipedia,
Amo,
Pocket,
Yelp,
Mdn,
Weather,
GlobalConfig,
AmpMobile,
}
impl From<SuggestRecord> for SuggestRecordType {
fn from(suggest_record: SuggestRecord) -> Self {
match suggest_record {
SuggestRecord::Amo => Self::Amo,
SuggestRecord::AmpWikipedia => Self::AmpWikipedia,
SuggestRecord::Icon => Self::Icon,
SuggestRecord::Mdn => Self::Mdn,
SuggestRecord::Pocket => Self::Pocket,
SuggestRecord::Weather(_) => Self::Weather,
SuggestRecord::Yelp => Self::Yelp,
SuggestRecord::GlobalConfig(_) => Self::GlobalConfig,
SuggestRecord::AmpMobile => Self::AmpMobile,
}
}
}
impl fmt::Display for SuggestRecordType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Icon => write!(f, "icon"),
Self::AmpWikipedia => write!(f, "data"),
Self::Amo => write!(f, "amo-suggestions"),
Self::Pocket => write!(f, "pocket-suggestions"),
Self::Yelp => write!(f, "yelp-suggestions"),
Self::Mdn => write!(f, "mdn-suggestions"),
Self::Weather => write!(f, "weather"),
Self::GlobalConfig => write!(f, "configuration"),
Self::AmpMobile => write!(f, "amp-mobile-suggestions"),
}
}
}
impl SuggestRecordType {
/// Return the meta key for the last ingested record.
pub fn last_ingest_meta_key(&self) -> String {
format!("last_quicksuggest_ingest_{}", self)
}
}
/// Represents either a single value, or a list of values. This is used to
/// deserialize downloaded attachments.
#[derive(Clone, Debug, Deserialize)]
@ -156,16 +225,18 @@ where
}
/// Fields that are common to all downloaded suggestions.
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Default, Deserialize)]
pub(crate) struct DownloadedSuggestionCommonDetails {
pub keywords: Vec<String>,
pub title: String,
pub url: String,
pub score: Option<f64>,
#[serde(default)]
pub full_keywords: Vec<(String, usize)>,
}
/// An AMP suggestion to ingest from an AMP-Wikipedia attachment.
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Default, Deserialize)]
pub(crate) struct DownloadedAmpSuggestion {
#[serde(flatten)]
pub common_details: DownloadedSuggestionCommonDetails,
@ -180,7 +251,7 @@ pub(crate) struct DownloadedAmpSuggestion {
}
/// A Wikipedia suggestion to ingest from an AMP-Wikipedia attachment.
#[derive(Clone, Debug, Deserialize)]
#[derive(Clone, Debug, Default, Deserialize)]
pub(crate) struct DownloadedWikipediaSuggestion {
#[serde(flatten)]
pub common_details: DownloadedSuggestionCommonDetails,
@ -214,6 +285,34 @@ impl DownloadedAmpWikipediaSuggestion {
}
}
impl DownloadedSuggestionCommonDetails {
/// Iterate over all keywords for this suggestion
pub fn keywords(&self) -> impl Iterator<Item = AmpKeyword<'_>> {
let full_keywords = self
.full_keywords
.iter()
.flat_map(|(full_keyword, repeat_for)| {
std::iter::repeat(Some(full_keyword.as_str())).take(*repeat_for)
})
.chain(std::iter::repeat(None)); // In case of insufficient full keywords, just fill in with infinite `None`s
//
self.keywords.iter().zip(full_keywords).enumerate().map(
move |(i, (keyword, full_keyword))| AmpKeyword {
rank: i,
keyword,
full_keyword,
},
)
}
}
#[derive(Debug, PartialEq, Eq)]
pub(crate) struct AmpKeyword<'a> {
pub rank: usize,
pub keyword: &'a str,
pub full_keyword: Option<&'a str>,
}
impl<'de> Deserialize<'de> for DownloadedAmpWikipediaSuggestion {
fn deserialize<D>(
deserializer: D,
@ -344,3 +443,119 @@ where
{
String::deserialize(deserializer).map(|s| s.parse().ok())
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_full_keywords() {
let suggestion = DownloadedAmpWikipediaSuggestion::Amp(DownloadedAmpSuggestion {
common_details: DownloadedSuggestionCommonDetails {
keywords: vec![
String::from("f"),
String::from("fo"),
String::from("foo"),
String::from("foo b"),
String::from("foo ba"),
String::from("foo bar"),
],
full_keywords: vec![(String::from("foo"), 3), (String::from("foo bar"), 3)],
..DownloadedSuggestionCommonDetails::default()
},
..DownloadedAmpSuggestion::default()
});
assert_eq!(
Vec::from_iter(suggestion.common_details().keywords()),
vec![
AmpKeyword {
rank: 0,
keyword: "f",
full_keyword: Some("foo"),
},
AmpKeyword {
rank: 1,
keyword: "fo",
full_keyword: Some("foo"),
},
AmpKeyword {
rank: 2,
keyword: "foo",
full_keyword: Some("foo"),
},
AmpKeyword {
rank: 3,
keyword: "foo b",
full_keyword: Some("foo bar"),
},
AmpKeyword {
rank: 4,
keyword: "foo ba",
full_keyword: Some("foo bar"),
},
AmpKeyword {
rank: 5,
keyword: "foo bar",
full_keyword: Some("foo bar"),
},
],
);
}
#[test]
fn test_missing_full_keywords() {
let suggestion = DownloadedAmpWikipediaSuggestion::Amp(DownloadedAmpSuggestion {
common_details: DownloadedSuggestionCommonDetails {
keywords: vec![
String::from("f"),
String::from("fo"),
String::from("foo"),
String::from("foo b"),
String::from("foo ba"),
String::from("foo bar"),
],
// Only the first 3 keywords have full keywords associated with them
full_keywords: vec![(String::from("foo"), 3)],
..DownloadedSuggestionCommonDetails::default()
},
..DownloadedAmpSuggestion::default()
});
assert_eq!(
Vec::from_iter(suggestion.common_details().keywords()),
vec![
AmpKeyword {
rank: 0,
keyword: "f",
full_keyword: Some("foo"),
},
AmpKeyword {
rank: 1,
keyword: "fo",
full_keyword: Some("foo"),
},
AmpKeyword {
rank: 2,
keyword: "foo",
full_keyword: Some("foo"),
},
AmpKeyword {
rank: 3,
keyword: "foo b",
full_keyword: None,
},
AmpKeyword {
rank: 4,
keyword: "foo ba",
full_keyword: None,
},
AmpKeyword {
rank: 5,
keyword: "foo bar",
full_keyword: None,
},
],
);
}
}

178
third_party/rust/suggest/src/schema.rs поставляемый
Просмотреть файл

@ -13,7 +13,9 @@ use sql_support::open_database::{self, ConnectionInitializer};
/// 1. Bump this version.
/// 2. Add a migration from the old version to the new version in
/// [`SuggestConnectionInitializer::upgrade_from`].
pub const VERSION: u32 = 14;
/// a. If suggestions should be re-ingested after the migration, call `clear_database()` inside
/// the migration.
pub const VERSION: u32 = 17;
/// The current Suggest database schema.
pub const SQL: &str = "
@ -25,10 +27,19 @@ pub const SQL: &str = "
CREATE TABLE keywords(
keyword TEXT NOT NULL,
suggestion_id INTEGER NOT NULL REFERENCES suggestions(id) ON DELETE CASCADE,
full_keyword_id INTEGER NULL REFERENCES full_keywords(id) ON DELETE SET NULL,
rank INTEGER NOT NULL,
PRIMARY KEY (keyword, suggestion_id)
) WITHOUT ROWID;
-- full keywords are what we display to the user when a (partial) keyword matches
-- The FK to suggestion_id makes it so full keywords get deleted when the parent suggestion is deleted.
CREATE TABLE full_keywords(
id INTEGER PRIMARY KEY,
suggestion_id INTEGER NOT NULL REFERENCES suggestions(id) ON DELETE CASCADE,
full_keyword TEXT NOT NULL
);
CREATE TABLE prefix_keywords(
keyword_prefix TEXT NOT NULL,
keyword_suffix TEXT NOT NULL DEFAULT '',
@ -79,7 +90,8 @@ pub const SQL: &str = "
CREATE TABLE icons(
id TEXT PRIMARY KEY,
data BLOB NOT NULL
data BLOB NOT NULL,
mimetype TEXT NOT NULL
) WITHOUT ROWID;
CREATE TABLE yelp_subjects(
@ -111,6 +123,12 @@ pub const SQL: &str = "
description TEXT NOT NULL,
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
);
-- Just store the MD5 hash of the dismissed suggestion. The collision rate is low and the
-- impact of a collision is not showing a suggestion, which is not that bad.
CREATE TABLE dismissed_suggestions (
url_hash INTEGER PRIMARY KEY
) WITHOUT ROWID;
";
/// Initializes an SQLite connection to the Suggest database, performing
@ -139,15 +157,167 @@ impl ConnectionInitializer for SuggestConnectionInitializer {
Ok(db.execute_batch(SQL)?)
}
fn upgrade_from(&self, _db: &Transaction<'_>, version: u32) -> open_database::Result<()> {
fn upgrade_from(&self, tx: &Transaction<'_>, version: u32) -> open_database::Result<()> {
match version {
1..=13 => {
1..=15 => {
// Treat databases with these older schema versions as corrupt,
// so that they'll be replaced by a fresh, empty database with
// the current schema.
Err(open_database::Error::Corrupt)
}
16 => {
tx.execute(
"
CREATE TABLE dismissed_suggestions (
url_hash INTEGER PRIMARY KEY
) WITHOUT ROWID;",
(),
)?;
Ok(())
}
_ => Err(open_database::Error::IncompatibleVersion(version)),
}
}
}
/// Clears the database, removing all suggestions, icons, and metadata.
pub fn clear_database(db: &Connection) -> rusqlite::Result<()> {
db.execute_batch(
"
DELETE FROM meta;
DELETE FROM suggestions;
DELETE FROM icons;
DELETE FROM yelp_subjects;
DELETE FROM yelp_modifiers;
DELETE FROM yelp_location_signs;
DELETE FROM yelp_custom_details;
",
)
}
#[cfg(test)]
mod test {
use super::*;
use sql_support::open_database::test_utils::MigratedDatabaseFile;
// Snapshot of the v16 schema. We use this to test that we can migrate from there to the
// current schema.
const V16_SCHEMA: &str = r#"
CREATE TABLE meta(
key TEXT PRIMARY KEY,
value NOT NULL
) WITHOUT ROWID;
CREATE TABLE keywords(
keyword TEXT NOT NULL,
suggestion_id INTEGER NOT NULL REFERENCES suggestions(id) ON DELETE CASCADE,
full_keyword_id INTEGER NULL REFERENCES full_keywords(id) ON DELETE SET NULL,
rank INTEGER NOT NULL,
PRIMARY KEY (keyword, suggestion_id)
) WITHOUT ROWID;
-- full keywords are what we display to the user when a (partial) keyword matches
-- The FK to suggestion_id makes it so full keywords get deleted when the parent suggestion is deleted.
CREATE TABLE full_keywords(
id INTEGER PRIMARY KEY,
suggestion_id INTEGER NOT NULL REFERENCES suggestions(id) ON DELETE CASCADE,
full_keyword TEXT NOT NULL
);
CREATE TABLE prefix_keywords(
keyword_prefix TEXT NOT NULL,
keyword_suffix TEXT NOT NULL DEFAULT '',
confidence INTEGER NOT NULL DEFAULT 0,
rank INTEGER NOT NULL,
suggestion_id INTEGER NOT NULL REFERENCES suggestions(id) ON DELETE CASCADE,
PRIMARY KEY (keyword_prefix, keyword_suffix, suggestion_id)
) WITHOUT ROWID;
CREATE UNIQUE INDEX keywords_suggestion_id_rank ON keywords(suggestion_id, rank);
CREATE TABLE suggestions(
id INTEGER PRIMARY KEY,
record_id TEXT NOT NULL,
provider INTEGER NOT NULL,
title TEXT NOT NULL,
url TEXT NOT NULL,
score REAL NOT NULL
);
CREATE TABLE amp_custom_details(
suggestion_id INTEGER PRIMARY KEY,
advertiser TEXT NOT NULL,
block_id INTEGER NOT NULL,
iab_category TEXT NOT NULL,
impression_url TEXT NOT NULL,
click_url TEXT NOT NULL,
icon_id TEXT NOT NULL,
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
);
CREATE TABLE wikipedia_custom_details(
suggestion_id INTEGER PRIMARY KEY REFERENCES suggestions(id) ON DELETE CASCADE,
icon_id TEXT NOT NULL
);
CREATE TABLE amo_custom_details(
suggestion_id INTEGER PRIMARY KEY,
description TEXT NOT NULL,
guid TEXT NOT NULL,
icon_url TEXT NOT NULL,
rating TEXT,
number_of_ratings INTEGER NOT NULL,
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
);
CREATE INDEX suggestions_record_id ON suggestions(record_id);
CREATE TABLE icons(
id TEXT PRIMARY KEY,
data BLOB NOT NULL,
mimetype TEXT NOT NULL
) WITHOUT ROWID;
CREATE TABLE yelp_subjects(
keyword TEXT PRIMARY KEY,
record_id TEXT NOT NULL
) WITHOUT ROWID;
CREATE TABLE yelp_modifiers(
type INTEGER NOT NULL,
keyword TEXT NOT NULL,
record_id TEXT NOT NULL,
PRIMARY KEY (type, keyword)
) WITHOUT ROWID;
CREATE TABLE yelp_location_signs(
keyword TEXT PRIMARY KEY,
need_location INTEGER NOT NULL,
record_id TEXT NOT NULL
) WITHOUT ROWID;
CREATE TABLE yelp_custom_details(
icon_id TEXT PRIMARY KEY,
score REAL NOT NULL,
record_id TEXT NOT NULL
) WITHOUT ROWID;
CREATE TABLE mdn_custom_details(
suggestion_id INTEGER PRIMARY KEY,
description TEXT NOT NULL,
FOREIGN KEY(suggestion_id) REFERENCES suggestions(id) ON DELETE CASCADE
);
PRAGMA user_version=16;
"#;
/// Test running all schema upgrades from V16, which was the first schema with a "real"
/// migration.
///
/// If an upgrade fails, then this test will fail with a panic.
#[test]
fn test_all_upgrades() {
let db_file = MigratedDatabaseFile::new(SuggestConnectionInitializer, V16_SCHEMA);
db_file.run_all_upgrades();
}
}

831
third_party/rust/suggest/src/store.rs поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

5
third_party/rust/suggest/src/suggest.udl поставляемый
Просмотреть файл

@ -40,6 +40,7 @@ interface Suggestion {
string url,
string raw_url,
sequence<u8>? icon,
string? icon_mimetype,
string full_keyword,
i64 block_id,
string advertiser,
@ -59,6 +60,7 @@ interface Suggestion {
string title,
string url,
sequence<u8>? icon,
string? icon_mimetype,
string full_keyword
);
Amo(
@ -75,6 +77,7 @@ interface Suggestion {
string url,
string title,
sequence<u8>? icon,
string? icon_mimetype,
f64 score,
boolean has_location_sign,
boolean subject_exact_match,
@ -99,6 +102,7 @@ dictionary SuggestionQuery {
dictionary SuggestIngestionConstraints {
u64? max_suggestions = null;
sequence<SuggestionProvider>? providers = null;
};
dictionary SuggestGlobalConfig {
@ -140,6 +144,7 @@ interface SuggestStoreBuilder {
[Self=ByArc]
SuggestStoreBuilder data_path(string path);
// Deprecated: this is no longer used by the suggest component.
[Self=ByArc]
SuggestStoreBuilder cache_path(string path);

3
third_party/rust/suggest/src/suggestion.rs поставляемый
Просмотреть файл

@ -29,6 +29,7 @@ pub enum Suggestion {
url: String,
raw_url: String,
icon: Option<Vec<u8>>,
icon_mimetype: Option<String>,
full_keyword: String,
block_id: i64,
advertiser: String,
@ -48,6 +49,7 @@ pub enum Suggestion {
title: String,
url: String,
icon: Option<Vec<u8>>,
icon_mimetype: Option<String>,
full_keyword: String,
},
Amo {
@ -64,6 +66,7 @@ pub enum Suggestion {
url: String,
title: String,
icon: Option<Vec<u8>>,
icon_mimetype: Option<String>,
score: f64,
has_location_sign: bool,
subject_exact_match: bool,

28
third_party/rust/suggest/src/yelp.rs поставляемый
Просмотреть файл

@ -52,7 +52,7 @@ const SUBJECT_PREFIX_MATCH_THRESHOLD: usize = 2;
impl<'a> SuggestDao<'a> {
/// Inserts the suggestions for Yelp attachment into the database.
pub fn insert_yelp_suggestions(
pub(crate) fn insert_yelp_suggestions(
&mut self,
record_id: &SuggestRecordId,
suggestion: &DownloadedYelpSuggestion,
@ -130,7 +130,10 @@ impl<'a> SuggestDao<'a> {
}
/// Fetch Yelp suggestion from given user's query.
pub fn fetch_yelp_suggestions(&self, query: &SuggestionQuery) -> Result<Vec<Suggestion>> {
pub(crate) fn fetch_yelp_suggestions(
&self,
query: &SuggestionQuery,
) -> Result<Vec<Suggestion>> {
if !query.providers.contains(&SuggestionProvider::Yelp) {
return Ok(vec![]);
}
@ -144,7 +147,7 @@ impl<'a> SuggestDao<'a> {
let Some((subject, subject_exact_match)) = self.find_subject(query_string)? else {
return Ok(vec![]);
};
let (icon, score) = self.fetch_custom_details()?;
let (icon, icon_mimetype, score) = self.fetch_custom_details()?;
let builder = SuggestionBuilder {
subject: &subject,
subject_exact_match,
@ -154,6 +157,7 @@ impl<'a> SuggestDao<'a> {
location: None,
need_location: false,
icon,
icon_mimetype,
score,
};
return Ok(vec![builder.into()]);
@ -185,7 +189,7 @@ impl<'a> SuggestDao<'a> {
return Ok(vec![]);
};
let (icon, score) = self.fetch_custom_details()?;
let (icon, icon_mimetype, score) = self.fetch_custom_details()?;
let builder = SuggestionBuilder {
subject: &subject,
subject_exact_match,
@ -195,6 +199,7 @@ impl<'a> SuggestDao<'a> {
location,
need_location,
icon,
icon_mimetype,
score,
};
Ok(vec![builder.into()])
@ -204,6 +209,7 @@ impl<'a> SuggestDao<'a> {
/// It returns the location tuple as follows:
/// (
/// Option<Vec<u8>>: Icon data. If not found, returns None.
/// Option<String>: Mimetype of the icon data. If not found, returns None.
/// f64: Reflects score field in the yelp_custom_details table.
/// )
///
@ -212,11 +218,11 @@ impl<'a> SuggestDao<'a> {
/// on Remote Settings. The following query will perform a table scan against
/// `yelp_custom_details` followed by an index search against `icons`,
/// which should be fine since there is only one record in the first table.
fn fetch_custom_details(&self) -> Result<(Option<Vec<u8>>, f64)> {
fn fetch_custom_details(&self) -> Result<(Option<Vec<u8>>, Option<String>, f64)> {
let result = self.conn.query_row_and_then_cachable(
r#"
SELECT
i.data, y.score
i.data, i.mimetype, y.score
FROM
yelp_custom_details y
LEFT JOIN
@ -226,7 +232,13 @@ impl<'a> SuggestDao<'a> {
1
"#,
(),
|row| -> Result<_> { Ok((row.get::<_, Option<Vec<u8>>>(0)?, row.get::<_, f64>(1)?)) },
|row| -> Result<_> {
Ok((
row.get::<_, Option<Vec<u8>>>(0)?,
row.get::<_, Option<String>>(1)?,
row.get::<_, f64>(2)?,
))
},
true,
)?;
@ -439,6 +451,7 @@ struct SuggestionBuilder<'a> {
location: Option<String>,
need_location: bool,
icon: Option<Vec<u8>>,
icon_mimetype: Option<String>,
score: f64,
}
@ -488,6 +501,7 @@ impl<'a> From<SuggestionBuilder<'a>> for Suggestion {
url,
title,
icon: builder.icon,
icon_mimetype: builder.icon_mimetype,
score: builder.score,
has_location_sign: location_modifier.is_none() && builder.location_sign.is_some(),
subject_exact_match: builder.subject_exact_match,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -158,7 +158,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerRemoteSettings() {
const pointerId = 0; // remote_settings:RemoteSettings
const pointerId = 1; // remote_settings:RemoteSettings
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -168,7 +168,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerRemoteSettings(value) {
const pointerId = 0; // remote_settings:RemoteSettings
const pointerId = 1; // remote_settings:RemoteSettings
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -356,7 +356,7 @@ export class RemoteSettings {
throw e;
}
return UniFFIScaffolding.callSync(
0, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
4, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
FfiConverterTypeRemoteSettingsConfig.lower(remoteSettingsConfig),
)
}
@ -383,7 +383,7 @@ export class RemoteSettings {
throw e;
}
return UniFFIScaffolding.callAsync(
1, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
5, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
FfiConverterTypeRemoteSettings.lower(this),
FfiConverterString.lower(attachmentId),
FfiConverterString.lower(path),
@ -401,7 +401,7 @@ export class RemoteSettings {
const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
2, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
6, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
FfiConverterTypeRemoteSettings.lower(this),
)
}
@ -425,7 +425,7 @@ export class RemoteSettings {
throw e;
}
return UniFFIScaffolding.callAsync(
3, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
7, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
FfiConverterTypeRemoteSettings.lower(this),
FfiConverterU64.lower(timestamp),
)

Просмотреть файл

@ -158,7 +158,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerSuggestStore() {
const pointerId = 1; // suggest:SuggestStore
const pointerId = 2; // suggest:SuggestStore
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -168,7 +168,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerSuggestStore(value) {
const pointerId = 1; // suggest:SuggestStore
const pointerId = 2; // suggest:SuggestStore
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -178,7 +178,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerSuggestStoreBuilder() {
const pointerId = 2; // suggest:SuggestStoreBuilder
const pointerId = 3; // suggest:SuggestStoreBuilder
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -188,7 +188,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerSuggestStoreBuilder(value) {
const pointerId = 2; // suggest:SuggestStoreBuilder
const pointerId = 3; // suggest:SuggestStoreBuilder
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -484,7 +484,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callSync(
4, // suggest:uniffi_suggest_fn_constructor_suggeststore_new
8, // suggest:uniffi_suggest_fn_constructor_suggeststore_new
FfiConverterString.lower(path),
FfiConverterOptionalTypeRemoteSettingsConfig.lower(settingsConfig),
)
@ -496,7 +496,7 @@ export class SuggestStore {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
5, // suggest:uniffi_suggest_fn_method_suggeststore_clear
9, // suggest:uniffi_suggest_fn_method_suggeststore_clear
FfiConverterTypeSuggestStore.lower(this),
)
}
@ -512,7 +512,7 @@ export class SuggestStore {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
6, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
10, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
FfiConverterTypeSuggestStore.lower(this),
)
}
@ -536,7 +536,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
7, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
11, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestionProvider.lower(provider),
)
@ -561,7 +561,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
8, // suggest:uniffi_suggest_fn_method_suggeststore_ingest
12, // suggest:uniffi_suggest_fn_method_suggeststore_ingest
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestIngestionConstraints.lower(constraints),
)
@ -578,7 +578,7 @@ export class SuggestStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
9, // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
13, // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
FfiConverterTypeSuggestStore.lower(this),
)
}
@ -598,7 +598,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
10, // suggest:uniffi_suggest_fn_method_suggeststore_query
14, // suggest:uniffi_suggest_fn_method_suggeststore_query
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestionQuery.lower(query),
)
@ -661,7 +661,7 @@ export class SuggestStoreBuilder {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
11, // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
15, // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
)
}
try {
@ -675,7 +675,7 @@ export class SuggestStoreBuilder {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
12, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
16, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
FfiConverterTypeSuggestStoreBuilder.lower(this),
)
}
@ -699,7 +699,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callAsync(
13, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
17, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterString.lower(path),
)
@ -724,7 +724,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callAsync(
14, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
18, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterString.lower(path),
)
@ -749,7 +749,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callAsync(
15, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config
19, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterTypeRemoteSettingsConfig.lower(config),
)
@ -841,7 +841,7 @@ export class FfiConverterTypeSuggestGlobalConfig extends FfiConverterArrayBuffer
}
export class SuggestIngestionConstraints {
constructor({ maxSuggestions = null } = {}) {
constructor({ maxSuggestions = null, providers = null } = {}) {
try {
FfiConverterOptionalu64.checkType(maxSuggestions)
} catch (e) {
@ -850,11 +850,21 @@ export class SuggestIngestionConstraints {
}
throw e;
}
try {
FfiConverterOptionalSequenceTypeSuggestionProvider.checkType(providers)
} catch (e) {
if (e instanceof UniFFITypeError) {
e.addItemDescriptionPart("providers");
}
throw e;
}
this.maxSuggestions = maxSuggestions;
this.providers = providers;
}
equals(other) {
return (
this.maxSuggestions == other.maxSuggestions
this.maxSuggestions == other.maxSuggestions &&
this.providers == other.providers
)
}
}
@ -864,15 +874,18 @@ export class FfiConverterTypeSuggestIngestionConstraints extends FfiConverterArr
static read(dataStream) {
return new SuggestIngestionConstraints({
maxSuggestions: FfiConverterOptionalu64.read(dataStream),
providers: FfiConverterOptionalSequenceTypeSuggestionProvider.read(dataStream),
});
}
static write(dataStream, value) {
FfiConverterOptionalu64.write(dataStream, value.maxSuggestions);
FfiConverterOptionalSequenceTypeSuggestionProvider.write(dataStream, value.providers);
}
static computeSize(value) {
let totalSize = 0;
totalSize += FfiConverterOptionalu64.computeSize(value.maxSuggestions);
totalSize += FfiConverterOptionalSequenceTypeSuggestionProvider.computeSize(value.providers);
return totalSize
}
@ -889,6 +902,14 @@ export class FfiConverterTypeSuggestIngestionConstraints extends FfiConverterArr
}
throw e;
}
try {
FfiConverterOptionalSequenceTypeSuggestionProvider.checkType(value.providers);
} catch (e) {
if (e instanceof UniFFITypeError) {
e.addItemDescriptionPart(".providers");
}
throw e;
}
}
}
@ -1174,6 +1195,7 @@ Suggestion.Amp = class extends Suggestion{
url,
rawUrl,
icon,
iconMimetype,
fullKeyword,
blockId,
advertiser,
@ -1188,6 +1210,7 @@ Suggestion.Amp = class extends Suggestion{
this.url = url;
this.rawUrl = rawUrl;
this.icon = icon;
this.iconMimetype = iconMimetype;
this.fullKeyword = fullKeyword;
this.blockId = blockId;
this.advertiser = advertiser;
@ -1217,12 +1240,14 @@ Suggestion.Wikipedia = class extends Suggestion{
title,
url,
icon,
iconMimetype,
fullKeyword
) {
super();
this.title = title;
this.url = url;
this.icon = icon;
this.iconMimetype = iconMimetype;
this.fullKeyword = fullKeyword;
}
}
@ -1253,6 +1278,7 @@ Suggestion.Yelp = class extends Suggestion{
url,
title,
icon,
iconMimetype,
score,
hasLocationSign,
subjectExactMatch,
@ -1262,6 +1288,7 @@ Suggestion.Yelp = class extends Suggestion{
this.url = url;
this.title = title;
this.icon = icon;
this.iconMimetype = iconMimetype;
this.score = score;
this.hasLocationSign = hasLocationSign;
this.subjectExactMatch = subjectExactMatch;
@ -1301,6 +1328,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
FfiConverterString.read(dataStream),
FfiConverterString.read(dataStream),
FfiConverterOptionalSequenceu8.read(dataStream),
FfiConverterOptionalstring.read(dataStream),
FfiConverterString.read(dataStream),
FfiConverterI64.read(dataStream),
FfiConverterString.read(dataStream),
@ -1322,6 +1350,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
FfiConverterString.read(dataStream),
FfiConverterString.read(dataStream),
FfiConverterOptionalSequenceu8.read(dataStream),
FfiConverterOptionalstring.read(dataStream),
FfiConverterString.read(dataStream)
);
case 4:
@ -1340,6 +1369,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
FfiConverterString.read(dataStream),
FfiConverterString.read(dataStream),
FfiConverterOptionalSequenceu8.read(dataStream),
FfiConverterOptionalstring.read(dataStream),
FfiConverterF64.read(dataStream),
FfiConverterBool.read(dataStream),
FfiConverterBool.read(dataStream),
@ -1368,6 +1398,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
FfiConverterString.write(dataStream, value.url);
FfiConverterString.write(dataStream, value.rawUrl);
FfiConverterOptionalSequenceu8.write(dataStream, value.icon);
FfiConverterOptionalstring.write(dataStream, value.iconMimetype);
FfiConverterString.write(dataStream, value.fullKeyword);
FfiConverterI64.write(dataStream, value.blockId);
FfiConverterString.write(dataStream, value.advertiser);
@ -1391,6 +1422,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
FfiConverterString.write(dataStream, value.title);
FfiConverterString.write(dataStream, value.url);
FfiConverterOptionalSequenceu8.write(dataStream, value.icon);
FfiConverterOptionalstring.write(dataStream, value.iconMimetype);
FfiConverterString.write(dataStream, value.fullKeyword);
return;
}
@ -1411,6 +1443,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
FfiConverterString.write(dataStream, value.url);
FfiConverterString.write(dataStream, value.title);
FfiConverterOptionalSequenceu8.write(dataStream, value.icon);
FfiConverterOptionalstring.write(dataStream, value.iconMimetype);
FfiConverterF64.write(dataStream, value.score);
FfiConverterBool.write(dataStream, value.hasLocationSign);
FfiConverterBool.write(dataStream, value.subjectExactMatch);
@ -1441,6 +1474,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
totalSize += FfiConverterString.computeSize(value.url);
totalSize += FfiConverterString.computeSize(value.rawUrl);
totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon);
totalSize += FfiConverterOptionalstring.computeSize(value.iconMimetype);
totalSize += FfiConverterString.computeSize(value.fullKeyword);
totalSize += FfiConverterI64.computeSize(value.blockId);
totalSize += FfiConverterString.computeSize(value.advertiser);
@ -1462,6 +1496,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
totalSize += FfiConverterString.computeSize(value.title);
totalSize += FfiConverterString.computeSize(value.url);
totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon);
totalSize += FfiConverterOptionalstring.computeSize(value.iconMimetype);
totalSize += FfiConverterString.computeSize(value.fullKeyword);
return totalSize;
}
@ -1480,6 +1515,7 @@ export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer {
totalSize += FfiConverterString.computeSize(value.url);
totalSize += FfiConverterString.computeSize(value.title);
totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon);
totalSize += FfiConverterOptionalstring.computeSize(value.iconMimetype);
totalSize += FfiConverterF64.computeSize(value.score);
totalSize += FfiConverterBool.computeSize(value.hasLocationSign);
totalSize += FfiConverterBool.computeSize(value.subjectExactMatch);
@ -1779,6 +1815,43 @@ export class FfiConverterOptionalSequenceu8 extends FfiConverterArrayBuffer {
}
}
// Export the FFIConverter object to make external types work.
export class FfiConverterOptionalSequenceTypeSuggestionProvider extends FfiConverterArrayBuffer {
static checkType(value) {
if (value !== undefined && value !== null) {
FfiConverterSequenceTypeSuggestionProvider.checkType(value)
}
}
static read(dataStream) {
const code = dataStream.readUint8(0);
switch (code) {
case 0:
return null
case 1:
return FfiConverterSequenceTypeSuggestionProvider.read(dataStream)
default:
throw UniFFIError(`Unexpected code: ${code}`);
}
}
static write(dataStream, value) {
if (value === null || value === undefined) {
dataStream.writeUint8(0);
return;
}
dataStream.writeUint8(1);
FfiConverterSequenceTypeSuggestionProvider.write(dataStream, value)
}
static computeSize(value) {
if (value === null || value === undefined) {
return 1;
}
return 1 + FfiConverterSequenceTypeSuggestionProvider.computeSize(value)
}
}
// Export the FFIConverter object to make external types work.
export class FfiConverterOptionalTypeRemoteSettingsConfig extends FfiConverterArrayBuffer {
static checkType(value) {
@ -1982,7 +2055,7 @@ export function rawSuggestionUrlMatches(rawUrl,url) {
throw e;
}
return UniFFIScaffolding.callSync(
16, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
20, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
FfiConverterString.lower(rawUrl),
FfiConverterString.lower(url),
)

Просмотреть файл

@ -158,7 +158,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerTabsBridgedEngine() {
const pointerId = 3; // tabs:TabsBridgedEngine
const pointerId = 4; // tabs:TabsBridgedEngine
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -168,7 +168,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerTabsBridgedEngine(value) {
const pointerId = 3; // tabs:TabsBridgedEngine
const pointerId = 4; // tabs:TabsBridgedEngine
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -178,7 +178,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerTabsStore() {
const pointerId = 4; // tabs:TabsStore
const pointerId = 5; // tabs:TabsStore
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -188,7 +188,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerTabsStore(value) {
const pointerId = 4; // tabs:TabsStore
const pointerId = 5; // tabs:TabsStore
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -361,7 +361,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
17, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
21, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -385,7 +385,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
18, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
22, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterString.lower(newSyncId),
)
@ -402,7 +402,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
19, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
23, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -426,7 +426,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
20, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
24, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterString.lower(clientData),
)
@ -443,7 +443,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
21, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
25, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -459,7 +459,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
22, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
26, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -483,7 +483,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
23, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
27, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterI64.lower(lastSync),
)
@ -516,7 +516,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
24, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
28, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterI64.lower(newTimestamp),
FfiConverterSequenceTypeTabsGuid.lower(uploadedIds),
@ -542,7 +542,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
25, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
29, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterSequencestring.lower(incomingEnvelopesAsJson),
)
@ -559,7 +559,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
26, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
30, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -575,7 +575,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
27, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
31, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -591,7 +591,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
28, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
32, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -607,7 +607,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
29, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
33, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@ -677,7 +677,7 @@ export class TabsStore {
throw e;
}
return UniFFIScaffolding.callAsync(
30, // tabs:uniffi_tabs_fn_constructor_tabsstore_new
34, // tabs:uniffi_tabs_fn_constructor_tabsstore_new
FfiConverterString.lower(path),
)
}
@ -692,7 +692,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
31, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
35, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
FfiConverterTypeTabsStore.lower(this),
)
}
@ -708,7 +708,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
32, // tabs:uniffi_tabs_fn_method_tabsstore_get_all
36, // tabs:uniffi_tabs_fn_method_tabsstore_get_all
FfiConverterTypeTabsStore.lower(this),
)
}
@ -724,7 +724,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
33, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
37, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
FfiConverterTypeTabsStore.lower(this),
)
}
@ -748,7 +748,7 @@ export class TabsStore {
throw e;
}
return UniFFIScaffolding.callAsync(
34, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
38, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
FfiConverterTypeTabsStore.lower(this),
FfiConverterSequenceTypeRemoteTabRecord.lower(remoteTabs),
)

Просмотреть файл

@ -29,6 +29,14 @@ main = [
"SuggestStore.interrupt",
]
[relevancy]
crate_name = "relevancy"
udl_file = "third_party/rust/relevancy/src/relevancy.udl"
[relevancy.receiver_thread]
default = "worker"
main = []
[remote_settings]
crate_name = "remote_settings"
udl_file = "third_party/rust/remote_settings/src/remote_settings.udl"

Просмотреть файл

@ -377,7 +377,7 @@ export function add(a,b) {
throw e;
}
return UniFFIScaffolding.callAsync(
35, // arithmetic:uniffi_arithmetical_fn_func_add
39, // arithmetic:uniffi_arithmetical_fn_func_add
FfiConverterU64.lower(a),
FfiConverterU64.lower(b),
)
@ -411,7 +411,7 @@ export function div(dividend,divisor) {
throw e;
}
return UniFFIScaffolding.callAsync(
36, // arithmetic:uniffi_arithmetical_fn_func_div
40, // arithmetic:uniffi_arithmetical_fn_func_div
FfiConverterU64.lower(dividend),
FfiConverterU64.lower(divisor),
)
@ -445,7 +445,7 @@ export function equal(a,b) {
throw e;
}
return UniFFIScaffolding.callAsync(
37, // arithmetic:uniffi_arithmetical_fn_func_equal
41, // arithmetic:uniffi_arithmetical_fn_func_equal
FfiConverterU64.lower(a),
FfiConverterU64.lower(b),
)
@ -479,7 +479,7 @@ export function sub(a,b) {
throw e;
}
return UniFFIScaffolding.callAsync(
38, // arithmetic:uniffi_arithmetical_fn_func_sub
42, // arithmetic:uniffi_arithmetical_fn_func_sub
FfiConverterU64.lower(a),
FfiConverterU64.lower(b),
)

Просмотреть файл

@ -455,7 +455,7 @@ export function getCustomTypesDemo(demo) {
throw e;
}
return UniFFIScaffolding.callAsync(
39, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo
43, // custom_types:uniffi_uniffi_custom_types_fn_func_get_custom_types_demo
FfiConverterOptionalTypeCustomTypesDemo.lower(demo),
)
}

Просмотреть файл

@ -381,7 +381,7 @@ export function gradient(value) {
throw e;
}
return UniFFIScaffolding.callAsync(
40, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient
44, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient
FfiConverterOptionalTypeLine.lower(value),
)
}
@ -414,7 +414,7 @@ export function intersection(ln1,ln2) {
throw e;
}
return UniFFIScaffolding.callAsync(
41, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection
45, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection
FfiConverterTypeLine.lower(ln1),
FfiConverterTypeLine.lower(ln2),
)

Просмотреть файл

@ -596,7 +596,7 @@ export function logEvenNumbers(logger,items) {
throw e;
}
return UniFFIScaffolding.callAsync(
42, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers
46, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers
FfiConverterTypeLogger.lower(logger),
FfiConverterSequencei32.lower(items),
)
@ -630,7 +630,7 @@ export function logEvenNumbersMainThread(logger,items) {
throw e;
}
return UniFFIScaffolding.callSync(
43, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread
47, // fixture_callbacks:uniffi_uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread
FfiConverterTypeLogger.lower(logger),
FfiConverterSequencei32.lower(items),
)

Просмотреть файл

@ -474,7 +474,7 @@ export function gradient(ln) {
throw e;
}
return UniFFIScaffolding.callAsync(
44, // geometry:uniffi_uniffi_geometry_fn_func_gradient
48, // geometry:uniffi_uniffi_geometry_fn_func_gradient
FfiConverterTypeLine.lower(ln),
)
}
@ -507,7 +507,7 @@ export function intersection(ln1,ln2) {
throw e;
}
return UniFFIScaffolding.callAsync(
45, // geometry:uniffi_uniffi_geometry_fn_func_intersection
49, // geometry:uniffi_uniffi_geometry_fn_func_intersection
FfiConverterTypeLine.lower(ln1),
FfiConverterTypeLine.lower(ln2),
)

Просмотреть файл

@ -158,7 +158,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerOptionneur() {
const pointerId = 5; // rondpoint:Optionneur
const pointerId = 6; // rondpoint:Optionneur
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -168,7 +168,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerOptionneur(value) {
const pointerId = 5; // rondpoint:Optionneur
const pointerId = 6; // rondpoint:Optionneur
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -178,7 +178,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerRetourneur() {
const pointerId = 6; // rondpoint:Retourneur
const pointerId = 7; // rondpoint:Retourneur
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -188,7 +188,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerRetourneur(value) {
const pointerId = 6; // rondpoint:Retourneur
const pointerId = 7; // rondpoint:Retourneur
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -198,7 +198,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerStringifier() {
const pointerId = 7; // rondpoint:Stringifier
const pointerId = 8; // rondpoint:Stringifier
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -208,7 +208,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerStringifier(value) {
const pointerId = 7; // rondpoint:Stringifier
const pointerId = 8; // rondpoint:Stringifier
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -620,7 +620,7 @@ export class Optionneur {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
46, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new
50, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new
)
}
try {
@ -642,7 +642,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
47, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean
51, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean
FfiConverterTypeOptionneur.lower(this),
FfiConverterBool.lower(value),
)
@ -667,7 +667,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
48, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum
52, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum
FfiConverterTypeOptionneur.lower(this),
FfiConverterTypeEnumeration.lower(value),
)
@ -692,7 +692,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
49, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32
53, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32
FfiConverterTypeOptionneur.lower(this),
FfiConverterF32.lower(value),
)
@ -717,7 +717,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
50, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64
54, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64
FfiConverterTypeOptionneur.lower(this),
FfiConverterF64.lower(value),
)
@ -742,7 +742,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
51, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec
55, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI16.lower(value),
)
@ -767,7 +767,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
52, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex
56, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI16.lower(value),
)
@ -792,7 +792,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
53, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec
57, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI32.lower(value),
)
@ -817,7 +817,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
54, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex
58, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI32.lower(value),
)
@ -842,7 +842,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
55, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec
59, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI64.lower(value),
)
@ -867,7 +867,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
56, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex
60, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI64.lower(value),
)
@ -892,7 +892,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
57, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec
61, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI8.lower(value),
)
@ -917,7 +917,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
58, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex
62, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI8.lower(value),
)
@ -942,7 +942,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
59, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null
63, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null
FfiConverterTypeOptionneur.lower(this),
FfiConverterOptionalstring.lower(value),
)
@ -967,7 +967,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
60, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence
64, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence
FfiConverterTypeOptionneur.lower(this),
FfiConverterSequencestring.lower(value),
)
@ -992,7 +992,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
61, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string
65, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string
FfiConverterTypeOptionneur.lower(this),
FfiConverterString.lower(value),
)
@ -1017,7 +1017,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
62, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec
66, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU16.lower(value),
)
@ -1042,7 +1042,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
63, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex
67, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU16.lower(value),
)
@ -1067,7 +1067,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
64, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec
68, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU32.lower(value),
)
@ -1092,7 +1092,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
65, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex
69, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU32.lower(value),
)
@ -1117,7 +1117,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
66, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct
70, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct
FfiConverterTypeOptionneur.lower(this),
FfiConverterU32.lower(value),
)
@ -1142,7 +1142,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
67, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec
71, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU64.lower(value),
)
@ -1167,7 +1167,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
68, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex
72, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU64.lower(value),
)
@ -1192,7 +1192,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
69, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec
73, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU8.lower(value),
)
@ -1217,7 +1217,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
70, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex
74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU8.lower(value),
)
@ -1242,7 +1242,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
71, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero
75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero
FfiConverterTypeOptionneur.lower(this),
FfiConverterOptionali32.lower(value),
)
@ -1305,7 +1305,7 @@ export class Retourneur {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
72, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new
76, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new
)
}
try {
@ -1327,7 +1327,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
73, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean
77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean
FfiConverterTypeRetourneur.lower(this),
FfiConverterBool.lower(value),
)
@ -1352,7 +1352,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double
78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double
FfiConverterTypeRetourneur.lower(this),
FfiConverterF64.lower(value),
)
@ -1377,7 +1377,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float
79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float
FfiConverterTypeRetourneur.lower(this),
FfiConverterF32.lower(value),
)
@ -1402,7 +1402,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
76, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16
80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16
FfiConverterTypeRetourneur.lower(this),
FfiConverterI16.lower(value),
)
@ -1427,7 +1427,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32
81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32
FfiConverterTypeRetourneur.lower(this),
FfiConverterI32.lower(value),
)
@ -1452,7 +1452,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64
82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64
FfiConverterTypeRetourneur.lower(this),
FfiConverterI64.lower(value),
)
@ -1477,7 +1477,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8
83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8
FfiConverterTypeRetourneur.lower(this),
FfiConverterI8.lower(value),
)
@ -1502,7 +1502,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres
84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres
FfiConverterTypeRetourneur.lower(this),
FfiConverterTypeDictionnaireNombres.lower(value),
)
@ -1527,7 +1527,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes
85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes
FfiConverterTypeRetourneur.lower(this),
FfiConverterTypeDictionnaireNombresSignes.lower(value),
)
@ -1552,7 +1552,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire
86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire
FfiConverterTypeRetourneur.lower(this),
FfiConverterTypeOptionneurDictionnaire.lower(value),
)
@ -1577,7 +1577,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string
87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string
FfiConverterTypeRetourneur.lower(this),
FfiConverterString.lower(value),
)
@ -1602,7 +1602,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16
88, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16
FfiConverterTypeRetourneur.lower(this),
FfiConverterU16.lower(value),
)
@ -1627,7 +1627,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32
89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32
FfiConverterTypeRetourneur.lower(this),
FfiConverterU32.lower(value),
)
@ -1652,7 +1652,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64
90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64
FfiConverterTypeRetourneur.lower(this),
FfiConverterU64.lower(value),
)
@ -1677,7 +1677,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8
91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8
FfiConverterTypeRetourneur.lower(this),
FfiConverterU8.lower(value),
)
@ -1740,7 +1740,7 @@ export class Stringifier {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
88, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new
92, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new
)
}
try {
@ -1762,7 +1762,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean
93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean
FfiConverterTypeStringifier.lower(this),
FfiConverterBool.lower(value),
)
@ -1787,7 +1787,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double
94, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double
FfiConverterTypeStringifier.lower(this),
FfiConverterF64.lower(value),
)
@ -1812,7 +1812,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float
95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float
FfiConverterTypeStringifier.lower(this),
FfiConverterF32.lower(value),
)
@ -1837,7 +1837,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
92, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16
96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16
FfiConverterTypeStringifier.lower(this),
FfiConverterI16.lower(value),
)
@ -1862,7 +1862,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32
97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32
FfiConverterTypeStringifier.lower(this),
FfiConverterI32.lower(value),
)
@ -1887,7 +1887,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
94, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64
98, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64
FfiConverterTypeStringifier.lower(this),
FfiConverterI64.lower(value),
)
@ -1912,7 +1912,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8
99, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8
FfiConverterTypeStringifier.lower(this),
FfiConverterI8.lower(value),
)
@ -1937,7 +1937,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16
100, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16
FfiConverterTypeStringifier.lower(this),
FfiConverterU16.lower(value),
)
@ -1962,7 +1962,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32
101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32
FfiConverterTypeStringifier.lower(this),
FfiConverterU32.lower(value),
)
@ -1987,7 +1987,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
98, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64
102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64
FfiConverterTypeStringifier.lower(this),
FfiConverterU64.lower(value),
)
@ -2012,7 +2012,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
99, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8
103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8
FfiConverterTypeStringifier.lower(this),
FfiConverterU8.lower(value),
)
@ -2037,7 +2037,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
100, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string
104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string
FfiConverterTypeStringifier.lower(this),
FfiConverterString.lower(value),
)
@ -3272,7 +3272,7 @@ export function copieCarte(c) {
throw e;
}
return UniFFIScaffolding.callAsync(
101, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte
105, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte
FfiConverterMapStringTypeEnumerationAvecDonnees.lower(c),
)
}
@ -3297,7 +3297,7 @@ export function copieDictionnaire(d) {
throw e;
}
return UniFFIScaffolding.callAsync(
102, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire
106, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire
FfiConverterTypeDictionnaire.lower(d),
)
}
@ -3322,7 +3322,7 @@ export function copieEnumeration(e) {
throw e;
}
return UniFFIScaffolding.callAsync(
103, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration
107, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration
FfiConverterTypeEnumeration.lower(e),
)
}
@ -3347,7 +3347,7 @@ export function copieEnumerations(e) {
throw e;
}
return UniFFIScaffolding.callAsync(
104, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations
108, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations
FfiConverterSequenceTypeEnumeration.lower(e),
)
}
@ -3372,7 +3372,7 @@ export function switcheroo(b) {
throw e;
}
return UniFFIScaffolding.callAsync(
105, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo
109, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo
FfiConverterBool.lower(b),
)
}

Просмотреть файл

@ -158,7 +158,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerSprite() {
const pointerId = 8; // sprites:Sprite
const pointerId = 9; // sprites:Sprite
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -168,7 +168,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerSprite(value) {
const pointerId = 8; // sprites:Sprite
const pointerId = 9; // sprites:Sprite
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -325,7 +325,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
106, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new
110, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new
FfiConverterOptionalTypePoint.lower(initialPosition),
)
}
@ -361,7 +361,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
107, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to
111, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to
FfiConverterTypePoint.lower(reference),
FfiConverterTypeVector.lower(direction),
)
@ -377,7 +377,7 @@ export class Sprite {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
108, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position
112, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position
FfiConverterTypeSprite.lower(this),
)
}
@ -401,7 +401,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
109, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by
113, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by
FfiConverterTypeSprite.lower(this),
FfiConverterTypeVector.lower(direction),
)
@ -426,7 +426,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
110, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to
114, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to
FfiConverterTypeSprite.lower(this),
FfiConverterTypePoint.lower(position),
)
@ -674,7 +674,7 @@ export function translate(position,direction) {
throw e;
}
return UniFFIScaffolding.callAsync(
111, // sprites:uniffi_uniffi_sprites_fn_func_translate
115, // sprites:uniffi_uniffi_sprites_fn_func_translate
FfiConverterTypePoint.lower(position),
FfiConverterTypeVector.lower(direction),
)

Просмотреть файл

@ -158,7 +158,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
readPointerTodoList() {
const pointerId = 9; // todolist:TodoList
const pointerId = 10; // todolist:TodoList
const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos);
this.pos += 8;
return res;
@ -168,7 +168,7 @@ class ArrayBufferDataStream {
// UniFFI Pointers are **always** 8 bytes long. That is enforced
// by the C++ and Rust Scaffolding code.
writePointerTodoList(value) {
const pointerId = 9; // todolist:TodoList
const pointerId = 10; // todolist:TodoList
UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos);
this.pos += 8;
}
@ -298,7 +298,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
112, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new
116, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new
)
}
try {
@ -320,7 +320,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
113, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries
117, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries
FfiConverterTypeTodoList.lower(this),
FfiConverterSequenceTypeTodoEntry.lower(entries),
)
@ -345,7 +345,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
114, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry
118, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry
FfiConverterTypeTodoList.lower(this),
FfiConverterTypeTodoEntry.lower(entry),
)
@ -370,7 +370,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
115, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item
119, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item
FfiConverterTypeTodoList.lower(this),
FfiConverterString.lower(todo),
)
@ -395,7 +395,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
116, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items
120, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items
FfiConverterTypeTodoList.lower(this),
FfiConverterSequencestring.lower(items),
)
@ -420,7 +420,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
117, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item
121, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item
FfiConverterTypeTodoList.lower(this),
FfiConverterString.lower(todo),
)
@ -437,7 +437,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
118, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries
122, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries
FfiConverterTypeTodoList.lower(this),
)
}
@ -453,7 +453,7 @@ export class TodoList {
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
119, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first
123, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first
FfiConverterTypeTodoList.lower(this),
)
}
@ -469,7 +469,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
120, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items
124, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items
FfiConverterTypeTodoList.lower(this),
)
}
@ -485,7 +485,7 @@ export class TodoList {
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
121, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last
125, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last
FfiConverterTypeTodoList.lower(this),
)
}
@ -501,7 +501,7 @@ export class TodoList {
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
122, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry
126, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry
FfiConverterTypeTodoList.lower(this),
)
}
@ -517,7 +517,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
123, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default
127, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default
FfiConverterTypeTodoList.lower(this),
)
}
@ -876,7 +876,7 @@ export function createEntryWith(todo) {
throw e;
}
return UniFFIScaffolding.callAsync(
124, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with
128, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with
FfiConverterString.lower(todo),
)
}
@ -893,7 +893,7 @@ export function getDefaultList() {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
125, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list
129, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list
)
}
try {
@ -917,7 +917,7 @@ export function setDefaultList(list) {
throw e;
}
return UniFFIScaffolding.callAsync(
126, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list
130, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list
FfiConverterTypeTodoList.lower(list),
)
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -24,6 +24,11 @@ using dom::UniFFIScaffoldingCallResult;
// Define scaffolding functions from UniFFI
extern "C" {
void uniffi_relevancy_fn_free_relevancystore(void *, RustCallStatus*);
void * uniffi_relevancy_fn_constructor_relevancystore_new(RustBuffer, RustCallStatus*);
RustBuffer uniffi_relevancy_fn_method_relevancystore_calculate_metrics(void *, RustCallStatus*);
void uniffi_relevancy_fn_method_relevancystore_ingest(void *, RustBuffer, RustCallStatus*);
RustBuffer uniffi_relevancy_fn_method_relevancystore_user_interest_vector(void *, RustCallStatus*);
void uniffi_remote_settings_fn_free_remotesettings(void *, RustCallStatus*);
void * uniffi_remote_settings_fn_constructor_remotesettings_new(RustBuffer, RustCallStatus*);
void uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path(void *, RustBuffer, RustBuffer, RustCallStatus*);
@ -67,6 +72,10 @@ extern "C" {
}
// Define pointer types
const static mozilla::uniffi::UniFFIPointerType kRelevancyRelevancyStorePointerType {
"relevancy::RelevancyStore"_ns,
uniffi_relevancy_fn_free_relevancystore
};
const static mozilla::uniffi::UniFFIPointerType kRemoteSettingsRemoteSettingsPointerType {
"remote_settings::RemoteSettings"_ns,
uniffi_remote_settings_fn_free_remotesettings
@ -101,143 +110,159 @@ Maybe<CallbackInterfaceInfo> UniFFIGetCallbackInterfaceInfo(uint64_t aInterfaceI
Maybe<already_AddRefed<Promise>> UniFFICallAsync(const GlobalObject& aGlobal, uint64_t aId, const Sequence<ScaffoldingType>& aArgs, ErrorResult& aError) {
switch (aId) {
case 0: { // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
case 0: { // relevancy:uniffi_relevancy_fn_constructor_relevancystore_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_relevancy_fn_constructor_relevancystore_new, aGlobal, aArgs, "uniffi_relevancy_fn_constructor_relevancystore_new: "_ns, aError));
}
case 1: { // relevancy:uniffi_relevancy_fn_method_relevancystore_calculate_metrics
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_relevancy_fn_method_relevancystore_calculate_metrics, aGlobal, aArgs, "uniffi_relevancy_fn_method_relevancystore_calculate_metrics: "_ns, aError));
}
case 2: { // relevancy:uniffi_relevancy_fn_method_relevancystore_ingest
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_relevancy_fn_method_relevancystore_ingest, aGlobal, aArgs, "uniffi_relevancy_fn_method_relevancystore_ingest: "_ns, aError));
}
case 3: { // relevancy:uniffi_relevancy_fn_method_relevancystore_user_interest_vector
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_relevancy_fn_method_relevancystore_user_interest_vector, aGlobal, aArgs, "uniffi_relevancy_fn_method_relevancystore_user_interest_vector: "_ns, aError));
}
case 4: { // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_remote_settings_fn_constructor_remotesettings_new, aGlobal, aArgs, "uniffi_remote_settings_fn_constructor_remotesettings_new: "_ns, aError));
}
case 1: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
case 5: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path, aGlobal, aArgs, "uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path: "_ns, aError));
}
case 2: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
case 6: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>>;
return Some(CallHandler::CallAsync(uniffi_remote_settings_fn_method_remotesettings_get_records, aGlobal, aArgs, "uniffi_remote_settings_fn_method_remotesettings_get_records: "_ns, aError));
}
case 3: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
case 7: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter<uint64_t>>;
return Some(CallHandler::CallAsync(uniffi_remote_settings_fn_method_remotesettings_get_records_since, aGlobal, aArgs, "uniffi_remote_settings_fn_method_remotesettings_get_records_since: "_ns, aError));
}
case 4: { // suggest:uniffi_suggest_fn_constructor_suggeststore_new
case 8: { // suggest:uniffi_suggest_fn_constructor_suggeststore_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_constructor_suggeststore_new, aGlobal, aArgs, "uniffi_suggest_fn_constructor_suggeststore_new: "_ns, aError));
}
case 5: { // suggest:uniffi_suggest_fn_method_suggeststore_clear
case 9: { // suggest:uniffi_suggest_fn_method_suggeststore_clear
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_clear, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_clear: "_ns, aError));
}
case 6: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
case 10: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_fetch_global_config, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_fetch_global_config: "_ns, aError));
}
case 7: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
case 11: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_fetch_provider_config, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_fetch_provider_config: "_ns, aError));
}
case 8: { // suggest:uniffi_suggest_fn_method_suggeststore_ingest
case 12: { // suggest:uniffi_suggest_fn_method_suggeststore_ingest
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_ingest, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_ingest: "_ns, aError));
}
case 9: { // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
case 13: { // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_interrupt, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_interrupt: "_ns, aError));
}
case 10: { // suggest:uniffi_suggest_fn_method_suggeststore_query
case 14: { // suggest:uniffi_suggest_fn_method_suggeststore_query
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_query, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_query: "_ns, aError));
}
case 11: { // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
case 15: { // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_constructor_suggeststorebuilder_new, aGlobal, aArgs, "uniffi_suggest_fn_constructor_suggeststorebuilder_new: "_ns, aError));
}
case 12: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
case 16: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_build, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_build: "_ns, aError));
}
case 13: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
case 17: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_cache_path, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_cache_path: "_ns, aError));
}
case 14: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
case 18: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_data_path, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_data_path: "_ns, aError));
}
case 15: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config
case 19: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config: "_ns, aError));
}
case 16: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
case 20: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_suggest_fn_func_raw_suggestion_url_matches, aGlobal, aArgs, "uniffi_suggest_fn_func_raw_suggestion_url_matches: "_ns, aError));
}
case 17: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
case 21: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_apply, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_apply: "_ns, aError));
}
case 18: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
case 22: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id: "_ns, aError));
}
case 19: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
case 23: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int64_t>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_last_sync, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_last_sync: "_ns, aError));
}
case 20: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
case 24: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync: "_ns, aError));
}
case 21: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
case 25: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_reset, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_reset: "_ns, aError));
}
case 22: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
case 26: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id: "_ns, aError));
}
case 23: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
case 27: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync: "_ns, aError));
}
case 24: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
case 28: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded: "_ns, aError));
}
case 25: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
case 29: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_store_incoming, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_store_incoming: "_ns, aError));
}
case 26: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
case 30: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_sync_finished, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_sync_finished: "_ns, aError));
}
case 27: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
case 31: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_sync_id, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_sync_id: "_ns, aError));
}
case 28: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
case 32: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_sync_started, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_sync_started: "_ns, aError));
}
case 29: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
case 33: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsbridgedengine_wipe, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsbridgedengine_wipe: "_ns, aError));
}
case 30: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
case 34: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_constructor_tabsstore_new, aGlobal, aArgs, "uniffi_tabs_fn_constructor_tabsstore_new: "_ns, aError));
}
case 31: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
case 35: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_bridged_engine, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_bridged_engine: "_ns, aError));
}
case 32: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
case 36: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_get_all, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_get_all: "_ns, aError));
}
case 33: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
case 37: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_register_with_sync_manager, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_register_with_sync_manager: "_ns, aError));
}
case 34: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
case 38: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
return Some(CallHandler::CallAsync(uniffi_tabs_fn_method_tabsstore_set_local_tabs, aGlobal, aArgs, "uniffi_tabs_fn_method_tabsstore_set_local_tabs: "_ns, aError));
}
@ -247,177 +272,197 @@ Maybe<already_AddRefed<Promise>> UniFFICallAsync(const GlobalObject& aGlobal, ui
bool UniFFICallSync(const GlobalObject& aGlobal, uint64_t aId, const Sequence<ScaffoldingType>& aArgs, RootedDictionary<UniFFIScaffoldingCallResult>& aReturnValue, ErrorResult& aError) {
switch (aId) {
case 0: { // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
case 0: { // relevancy:uniffi_relevancy_fn_constructor_relevancystore_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_relevancy_fn_constructor_relevancystore_new, aGlobal, aArgs, aReturnValue, "uniffi_relevancy_fn_constructor_relevancystore_new: "_ns, aError);
return true;
}
case 1: { // relevancy:uniffi_relevancy_fn_method_relevancystore_calculate_metrics
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>>;
CallHandler::CallSync(uniffi_relevancy_fn_method_relevancystore_calculate_metrics, aGlobal, aArgs, aReturnValue, "uniffi_relevancy_fn_method_relevancystore_calculate_metrics: "_ns, aError);
return true;
}
case 2: { // relevancy:uniffi_relevancy_fn_method_relevancystore_ingest
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_relevancy_fn_method_relevancystore_ingest, aGlobal, aArgs, aReturnValue, "uniffi_relevancy_fn_method_relevancystore_ingest: "_ns, aError);
return true;
}
case 3: { // relevancy:uniffi_relevancy_fn_method_relevancystore_user_interest_vector
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>>;
CallHandler::CallSync(uniffi_relevancy_fn_method_relevancystore_user_interest_vector, aGlobal, aArgs, aReturnValue, "uniffi_relevancy_fn_method_relevancystore_user_interest_vector: "_ns, aError);
return true;
}
case 4: { // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_remote_settings_fn_constructor_remotesettings_new, aGlobal, aArgs, aReturnValue, "uniffi_remote_settings_fn_constructor_remotesettings_new: "_ns, aError);
return true;
}
case 1: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
case 5: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path, aGlobal, aArgs, aReturnValue, "uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path: "_ns, aError);
return true;
}
case 2: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
case 6: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>>;
CallHandler::CallSync(uniffi_remote_settings_fn_method_remotesettings_get_records, aGlobal, aArgs, aReturnValue, "uniffi_remote_settings_fn_method_remotesettings_get_records: "_ns, aError);
return true;
}
case 3: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
case 7: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter<uint64_t>>;
CallHandler::CallSync(uniffi_remote_settings_fn_method_remotesettings_get_records_since, aGlobal, aArgs, aReturnValue, "uniffi_remote_settings_fn_method_remotesettings_get_records_since: "_ns, aError);
return true;
}
case 4: { // suggest:uniffi_suggest_fn_constructor_suggeststore_new
case 8: { // suggest:uniffi_suggest_fn_constructor_suggeststore_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_constructor_suggeststore_new, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_constructor_suggeststore_new: "_ns, aError);
return true;
}
case 5: { // suggest:uniffi_suggest_fn_method_suggeststore_clear
case 9: { // suggest:uniffi_suggest_fn_method_suggeststore_clear
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststore_clear, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststore_clear: "_ns, aError);
return true;
}
case 6: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
case 10: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststore_fetch_global_config, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststore_fetch_global_config: "_ns, aError);
return true;
}
case 7: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
case 11: { // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststore_fetch_provider_config, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststore_fetch_provider_config: "_ns, aError);
return true;
}
case 8: { // suggest:uniffi_suggest_fn_method_suggeststore_ingest
case 12: { // suggest:uniffi_suggest_fn_method_suggeststore_ingest
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststore_ingest, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststore_ingest: "_ns, aError);
return true;
}
case 9: { // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
case 13: { // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststore_interrupt, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststore_interrupt: "_ns, aError);
return true;
}
case 10: { // suggest:uniffi_suggest_fn_method_suggeststore_query
case 14: { // suggest:uniffi_suggest_fn_method_suggeststore_query
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststore_query, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststore_query: "_ns, aError);
return true;
}
case 11: { // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
case 15: { // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>>;
CallHandler::CallSync(uniffi_suggest_fn_constructor_suggeststorebuilder_new, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_constructor_suggeststorebuilder_new: "_ns, aError);
return true;
}
case 12: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
case 16: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_build, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_build: "_ns, aError);
return true;
}
case 13: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
case 17: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_cache_path, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_cache_path: "_ns, aError);
return true;
}
case 14: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
case 18: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_data_path, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_data_path: "_ns, aError);
return true;
}
case 15: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config
case 19: { // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_config: "_ns, aError);
return true;
}
case 16: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
case 20: { // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int8_t>, ScaffoldingConverter<RustBuffer>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_suggest_fn_func_raw_suggestion_url_matches, aGlobal, aArgs, aReturnValue, "uniffi_suggest_fn_func_raw_suggestion_url_matches: "_ns, aError);
return true;
}
case 17: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
case 21: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_apply, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_apply: "_ns, aError);
return true;
}
case 18: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
case 22: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id: "_ns, aError);
return true;
}
case 19: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
case 23: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<int64_t>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_last_sync, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_last_sync: "_ns, aError);
return true;
}
case 20: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
case 24: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync: "_ns, aError);
return true;
}
case 21: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
case 25: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_reset, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_reset: "_ns, aError);
return true;
}
case 22: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
case 26: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id: "_ns, aError);
return true;
}
case 23: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
case 27: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync: "_ns, aError);
return true;
}
case 24: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
case 28: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<int64_t>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded: "_ns, aError);
return true;
}
case 25: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
case 29: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_store_incoming, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_store_incoming: "_ns, aError);
return true;
}
case 26: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
case 30: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_sync_finished, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_sync_finished: "_ns, aError);
return true;
}
case 27: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
case 31: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_sync_id, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_sync_id: "_ns, aError);
return true;
}
case 28: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
case 32: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_sync_started, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_sync_started: "_ns, aError);
return true;
}
case 29: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
case 33: { // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsbridgedengine_wipe, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsbridgedengine_wipe: "_ns, aError);
return true;
}
case 30: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
case 34: { // tabs:uniffi_tabs_fn_constructor_tabsstore_new
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_tabs_fn_constructor_tabsstore_new, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_constructor_tabsstore_new: "_ns, aError);
return true;
}
case 31: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
case 35: { // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
using CallHandler = ScaffoldingCallHandler<ScaffoldingObjectConverter<&kTabsTabsBridgedEnginePointerType>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_bridged_engine, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_bridged_engine: "_ns, aError);
return true;
}
case 32: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
case 36: { // tabs:uniffi_tabs_fn_method_tabsstore_get_all
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<RustBuffer>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_get_all, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_get_all: "_ns, aError);
return true;
}
case 33: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
case 37: { // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_register_with_sync_manager, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_register_with_sync_manager: "_ns, aError);
return true;
}
case 34: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
case 38: { // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
using CallHandler = ScaffoldingCallHandler<ScaffoldingConverter<void>, ScaffoldingObjectConverter<&kTabsTabsStorePointerType>, ScaffoldingConverter<RustBuffer>>;
CallHandler::CallSync(uniffi_tabs_fn_method_tabsstore_set_local_tabs, aGlobal, aArgs, aReturnValue, "uniffi_tabs_fn_method_tabsstore_set_local_tabs: "_ns, aError);
return true;
@ -429,23 +474,27 @@ bool UniFFICallSync(const GlobalObject& aGlobal, uint64_t aId, const Sequence<Sc
Maybe<already_AddRefed<UniFFIPointer>> UniFFIReadPointer(const GlobalObject& aGlobal, uint64_t aId, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) {
const UniFFIPointerType* type;
switch (aId) {
case 0: { // remote_settings:RemoteSettings
case 0: { // relevancy:RelevancyStore
type = &kRelevancyRelevancyStorePointerType;
break;
}
case 1: { // remote_settings:RemoteSettings
type = &kRemoteSettingsRemoteSettingsPointerType;
break;
}
case 1: { // suggest:SuggestStore
case 2: { // suggest:SuggestStore
type = &kSuggestSuggestStorePointerType;
break;
}
case 2: { // suggest:SuggestStoreBuilder
case 3: { // suggest:SuggestStoreBuilder
type = &kSuggestSuggestStoreBuilderPointerType;
break;
}
case 3: { // tabs:TabsBridgedEngine
case 4: { // tabs:TabsBridgedEngine
type = &kTabsTabsBridgedEnginePointerType;
break;
}
case 4: { // tabs:TabsStore
case 5: { // tabs:TabsStore
type = &kTabsTabsStorePointerType;
break;
}
@ -458,23 +507,27 @@ Maybe<already_AddRefed<UniFFIPointer>> UniFFIReadPointer(const GlobalObject& aGl
bool UniFFIWritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer& aPtr, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) {
const UniFFIPointerType* type;
switch (aId) {
case 0: { // remote_settings:RemoteSettings
case 0: { // relevancy:RelevancyStore
type = &kRelevancyRelevancyStorePointerType;
break;
}
case 1: { // remote_settings:RemoteSettings
type = &kRemoteSettingsRemoteSettingsPointerType;
break;
}
case 1: { // suggest:SuggestStore
case 2: { // suggest:SuggestStore
type = &kSuggestSuggestStorePointerType;
break;
}
case 2: { // suggest:SuggestStoreBuilder
case 3: { // suggest:SuggestStoreBuilder
type = &kSuggestSuggestStoreBuilderPointerType;
break;
}
case 3: { // tabs:TabsBridgedEngine
case 4: { // tabs:TabsBridgedEngine
type = &kTabsTabsBridgedEnginePointerType;
break;
}
case 4: { // tabs:TabsStore
case 5: { // tabs:TabsStore
type = &kTabsTabsStorePointerType;
break;
}

Просмотреть файл

@ -113,6 +113,7 @@ viaduct = "0.1"
webext_storage_bridge = { path = "../../../components/extensions/storage/webext_storage_bridge" }
tabs = { version = "0.1" }
suggest = { version = "0.1" }
relevancy = { version = "0.1" }
[target.'cfg(target_os = "windows")'.dependencies]
detect_win32k_conflicts = { path = "../../../xre/detect_win32k_conflicts" }

Просмотреть файл

@ -57,18 +57,15 @@ extern crate webext_storage_bridge;
extern crate tabs;
#[cfg(not(target_os = "android"))]
mod reexport_tabs {
mod reexport_appservices_uniffi_scaffolding {
tabs::uniffi_reexport_scaffolding!();
relevancy::uniffi_reexport_scaffolding!();
suggest::uniffi_reexport_scaffolding!();
}
#[cfg(not(target_os = "android"))]
extern crate suggest;
#[cfg(not(target_os = "android"))]
mod reexport_suggest {
suggest::uniffi_reexport_scaffolding!();
}
#[cfg(feature = "webrtc")]
extern crate mdns_service;
extern crate neqo_glue;