From 146638366864f73ee8a697ea76480eb02c00eb3c Mon Sep 17 00:00:00 2001 From: Lina Butler Date: Thu, 7 Sep 2023 05:40:28 +0000 Subject: [PATCH] Bug 1851845 - Update vendored Application Services dependencies. r=markh,adw This commit vendors the latest changes to the Suggest and Remote Settings Rust components. 1. From the `application-services` source tree, I ran `./tools/update-moz-central-vendoring.py ../m-c` to update the revisions in the m-c source tree. 2. I added the Remote Settings component UDL file to `toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py`, and updated `toolkit/components/uniffi-bindgen-gecko-js/config.toml` to call the `RemoteSettings` constructor on the main thread. The Suggest component uses the `RemoteSettingsConfig` type in its public API, so we must generate bindings for the Remote Settings component. 3. From the m-c source tree, I ran `./mach uniffi generate` to update the generated UniFFI bindings. Differential Revision: https://phabricator.services.mozilla.com/D187559 --- .cargo/config.in | 4 +- Cargo.lock | 24 +- Cargo.toml | 14 +- .../rust/remote_settings/.cargo-checksum.json | 2 +- third_party/rust/remote_settings/Cargo.toml | 2 + .../rust/remote_settings/android/build.gradle | 11 - .../android/src/main/AndroidManifest.xml | 2 - .../remotesettings/RemoteSettingsTest.kt | 168 --- .../rust/remote_settings/src/client.rs | 386 +++++- third_party/rust/remote_settings/src/error.rs | 2 - third_party/rust/remote_settings/src/lib.rs | 6 +- .../remote_settings/src/remote_settings.udl | 2 +- .../rust/sql-support/.cargo-checksum.json | 2 +- .../rust/sql-support/src/open_database.rs | 60 +- third_party/rust/suggest/.cargo-checksum.json | 2 +- third_party/rust/suggest/Cargo.toml | 4 + third_party/rust/suggest/src/db.rs | 181 ++- third_party/rust/suggest/src/lib.rs | 20 +- third_party/rust/suggest/src/provider.rs | 44 + third_party/rust/suggest/src/rs.rs | 251 ++-- third_party/rust/suggest/src/schema.rs | 36 +- third_party/rust/suggest/src/store.rs | 979 +++++++++----- third_party/rust/suggest/src/suggest.udl | 36 +- third_party/rust/suggest/src/suggestion.rs | 33 + .../generated/RustRemoteSettings.sys.mjs | 1204 +++++++++++++++++ .../components/generated/RustSuggest.sys.mjs | 446 +++--- .../components/moz.build | 1 + .../uniffi-bindgen-gecko-js/config.toml | 6 + .../fixtures/generated/RustArithmetic.sys.mjs | 8 +- .../generated/RustCustomTypes.sys.mjs | 2 +- .../generated/RustExternalTypes.sys.mjs | 2 +- .../generated/RustFixtureCallbacks.sys.mjs | 4 +- .../fixtures/generated/RustGeometry.sys.mjs | 4 +- .../fixtures/generated/RustRondpoint.sys.mjs | 132 +- .../fixtures/generated/RustSprites.sys.mjs | 16 +- .../fixtures/generated/RustTodolist.sys.mjs | 34 +- .../uniffi-bindgen-gecko-js/mach_commands.py | 1 + .../uniffi-js/UniFFIFixtureScaffolding.cpp | 384 +++--- .../uniffi-js/UniFFIGeneratedScaffolding.cpp | 53 + 39 files changed, 3175 insertions(+), 1393 deletions(-) delete mode 100644 third_party/rust/remote_settings/android/build.gradle delete mode 100644 third_party/rust/remote_settings/android/src/main/AndroidManifest.xml delete mode 100644 third_party/rust/remote_settings/android/src/test/java/org/mozilla/appservices/remotesettings/RemoteSettingsTest.kt create mode 100644 third_party/rust/suggest/src/provider.rs create mode 100644 third_party/rust/suggest/src/suggestion.rs create mode 100644 toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs diff --git a/.cargo/config.in b/.cargo/config.in index e01bde536d68..052cf5167de0 100644 --- a/.cargo/config.in +++ b/.cargo/config.in @@ -70,9 +70,9 @@ git = "https://github.com/mozilla-spidermonkey/jsparagus" rev = "64ba08e24749616de2344112f226d1ef4ba893ae" replace-with = "vendored-sources" -[source."git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a"] +[source."git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a"] git = "https://github.com/mozilla/application-services" -rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" +rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" replace-with = "vendored-sources" [source."git+https://github.com/mozilla/audioipc?rev=0b51291d2483a17dce3e300c7784b369e02bee73"] diff --git a/Cargo.lock b/Cargo.lock index 7fbcf67371b8..5623bdf1c573 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1530,7 +1530,7 @@ dependencies = [ [[package]] name = "error-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "error-support-macros", "lazy_static", @@ -1542,7 +1542,7 @@ dependencies = [ [[package]] name = "error-support-macros" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "proc-macro2", "quote", @@ -2762,7 +2762,7 @@ dependencies = [ [[package]] name = "interrupt-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "lazy_static", "parking_lot", @@ -3918,7 +3918,7 @@ dependencies = [ [[package]] name = "nss_build_common" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" [[package]] name = "nsstring" @@ -4578,7 +4578,7 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" [[package]] name = "remote_settings" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "parking_lot", "serde", @@ -5095,7 +5095,7 @@ dependencies = [ [[package]] name = "sql-support" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "ffi-support", "interrupt-support", @@ -5275,7 +5275,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "suggest" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "anyhow", "interrupt-support", @@ -5320,7 +5320,7 @@ dependencies = [ [[package]] name = "sync-guid" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "base64 0.13.999", "rand", @@ -5331,7 +5331,7 @@ dependencies = [ [[package]] name = "sync15" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "anyhow", "error-support", @@ -5363,7 +5363,7 @@ dependencies = [ [[package]] name = "tabs" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "anyhow", "error-support", @@ -6003,7 +6003,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "viaduct" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "ffi-support", "log", @@ -6159,7 +6159,7 @@ dependencies = [ [[package]] name = "webext-storage" version = "0.1.0" -source = "git+https://github.com/mozilla/application-services?rev=25972c388a4cf3a6d8256504f3a09b711db2fc6a#25972c388a4cf3a6d8256504f3a09b711db2fc6a" +source = "git+https://github.com/mozilla/application-services?rev=1a59041d0c7d36ef1abc713a48304c5333e45a1a#1a59041d0c7d36ef1abc713a48304c5333e45a1a" dependencies = [ "anyhow", "error-support", diff --git a/Cargo.toml b/Cargo.toml index e8ca5d01ae37..08f221da10cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -202,13 +202,13 @@ warp = { git = "https://github.com/glandium/warp", rev = "4af45fae95bc98b0eba1ef 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 = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } -sql-support = { git = "https://github.com/mozilla/application-services", rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } -suggest = { git = "https://github.com/mozilla/application-services", rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } -sync15 = { git = "https://github.com/mozilla/application-services", rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } -tabs = { git = "https://github.com/mozilla/application-services", rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } -viaduct = { git = "https://github.com/mozilla/application-services", rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } -webext-storage = { git = "https://github.com/mozilla/application-services", rev = "25972c388a4cf3a6d8256504f3a09b711db2fc6a" } +interrupt-support = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } +sql-support = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } +suggest = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } +sync15 = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } +tabs = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } +viaduct = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } +webext-storage = { git = "https://github.com/mozilla/application-services", rev = "1a59041d0c7d36ef1abc713a48304c5333e45a1a" } # ICU4X 1.2 with synstructure 0.13.x / syn 2.x. When updating to next version, this should be removed. diplomat = { git = "https://github.com/rust-diplomat/diplomat", rev = "8d125999893fedfdf30595e97334c21ec4b18da9" } diff --git a/third_party/rust/remote_settings/.cargo-checksum.json b/third_party/rust/remote_settings/.cargo-checksum.json index 1720c0a89883..8794c625fe1f 100644 --- a/third_party/rust/remote_settings/.cargo-checksum.json +++ b/third_party/rust/remote_settings/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"c13413955e0ab4939e98e7c0a3eda6d3015734d4764ffa3bc794faf7c975193d","android/build.gradle":"fb6aa2191f1545a92dbcb27552d3da09c19df6612bfa9ae1b70c7d241c50f65b","android/src/main/AndroidManifest.xml":"4c8c9223ad43961108867cf0940b39253c5d4e11ec39c0839a2f137f43ed482a","android/src/test/java/org/mozilla/appservices/remotesettings/RemoteSettingsTest.kt":"d27a6d70cb40607f21c23453d5a53055815ae77c35e59231ee0279787e8932e0","build.rs":"4326f03729cf8f1673e4228e6dc111de1ea4d8bcc06351f7ae563efb2613f866","src/client.rs":"a411e87b485dd3a66202d96c1ef195ba5bdc42fa12d91f9960a64bef2ee5da31","src/config.rs":"7bb678addfae3b4ed5f2892d32263e5b33cc05e5a12a250f664150e78211f94a","src/error.rs":"719a83fb653a8a9a63b26aea7e5fa5210f8a4633d560de92b2b55640715002b2","src/lib.rs":"1daf4dc8265919374b83958f2aa431d44974de44a3ccd926b04d3b0ec207a2cf","src/remote_settings.udl":"06428a5749b04d4f70d704ee561cf30c7f0ad074559b7de0960051a575010b71","uniffi.toml":"f8ec8dc593e0d501c2e9e40368ec93ec33b1edd8608e29495e0a54b63144e880"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"c74e3df90cd82fb4ee00dd38d7e39cd7a0142ad601b8b63ae214978a28fbe1ac","build.rs":"4326f03729cf8f1673e4228e6dc111de1ea4d8bcc06351f7ae563efb2613f866","src/client.rs":"3d87162e6913a81cc6f5178a7ca791e262d0d029e7dedf3df4fe2f66e5501185","src/config.rs":"7bb678addfae3b4ed5f2892d32263e5b33cc05e5a12a250f664150e78211f94a","src/error.rs":"192ca42af7c6b882f3129378c23b45dab8a0d2b179e23a8813a335ffd56b21dc","src/lib.rs":"416e99894e152f6cea7418ad2fabfd94bc3d907efd9f33fbd2a83fb99452b2df","src/remote_settings.udl":"e38758592ca75adbebb8fe688b10520d9931a5f3292d94f229cba05310756a43","uniffi.toml":"f8ec8dc593e0d501c2e9e40368ec93ec33b1edd8608e29495e0a54b63144e880"},"package":null} \ No newline at end of file diff --git a/third_party/rust/remote_settings/Cargo.toml b/third_party/rust/remote_settings/Cargo.toml index bba3bd5913bf..7c18e3131867 100644 --- a/third_party/rust/remote_settings/Cargo.toml +++ b/third_party/rust/remote_settings/Cargo.toml @@ -17,6 +17,7 @@ authors = [ "The Android Mobile Team ", "The Glean Team ", ] +exclude = ["/android"] description = "A Remote Settings client intended for application layer platforms." license = "MPL-2.0" @@ -32,6 +33,7 @@ url = "2.1" path = "../viaduct" [dev-dependencies] +expect-test = "1.4" mockito = "0.31" [dev-dependencies.viaduct-reqwest] diff --git a/third_party/rust/remote_settings/android/build.gradle b/third_party/rust/remote_settings/android/build.gradle deleted file mode 100644 index e371cd9417c8..000000000000 --- a/third_party/rust/remote_settings/android/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply from: "$rootDir/build-scripts/component-common.gradle" -apply from: "$rootDir/publish.gradle" - -ext.configureUniFFIBindgen("../src/remote_settings.udl") -ext.dependsOnTheMegazord() -ext.configurePublish() - -dependencies { - testImplementation("org.mozilla.components:concept-fetch:$android_components_version") - testImplementation project(":httpconfig") -} diff --git a/third_party/rust/remote_settings/android/src/main/AndroidManifest.xml b/third_party/rust/remote_settings/android/src/main/AndroidManifest.xml deleted file mode 100644 index 097a227d9a77..000000000000 --- a/third_party/rust/remote_settings/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/third_party/rust/remote_settings/android/src/test/java/org/mozilla/appservices/remotesettings/RemoteSettingsTest.kt b/third_party/rust/remote_settings/android/src/test/java/org/mozilla/appservices/remotesettings/RemoteSettingsTest.kt deleted file mode 100644 index 4c7a97888652..000000000000 --- a/third_party/rust/remote_settings/android/src/test/java/org/mozilla/appservices/remotesettings/RemoteSettingsTest.kt +++ /dev/null @@ -1,168 +0,0 @@ -/* 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/. */ - -package org.mozilla.appservices.remotesettings - -import mozilla.appservices.httpconfig.RustHttpConfig -import mozilla.appservices.remotesettings.RemoteSettings -import mozilla.appservices.remotesettings.RemoteSettingsConfig -import mozilla.components.concept.fetch.Client -import mozilla.components.concept.fetch.Headers -import mozilla.components.concept.fetch.MutableHeaders -import mozilla.components.concept.fetch.Request -import mozilla.components.concept.fetch.Response -import org.junit.Assert.assertEquals -import org.junit.Assert.assertTrue -import org.junit.Before -import org.junit.Rule -import org.junit.Test -import org.junit.rules.TemporaryFolder -import org.junit.runner.RunWith -import org.robolectric.RobolectricTestRunner -import java.io.File -import java.io.InputStream - -@RunWith(RobolectricTestRunner::class) -class RemoteSettingsTest { - - @Rule @JvmField - val tempDir = TemporaryFolder() - - private var fakeUrl = "" - private var fakeStatus = 200 - private var fakeHeaders: Headers = MutableHeaders("etag" to "1000") - private var fakeBodyStream = "".byteInputStream() - private var fakeContentType = "" - private var fakeBody = Response.Body(fakeBodyStream, fakeContentType) - private var doFetch: (Request) -> Response = { - Response(fakeUrl, fakeStatus, fakeHeaders, fakeBody) - } - - @Before - fun setup() { - RustHttpConfig.setClient( - lazyOf(object : Client() { - override fun fetch(request: Request): Response = doFetch(request) - }), - ) - } - - @Test - fun `test setting up, fetching records, and attachment downloading`() { - val config = RemoteSettingsConfig( - serverUrl = "http://localhost:8888", - bucketName = "the-bucket", - collectionName = "the-collection", - ) - - // Setup the client - val client = RemoteSettings(config) - - // Fetch the records - setupRecordResponse(config, responseBodyStream = recordJson.byteInputStream()) - val response = client.getRecords() - val records = response.records - assertEquals(records[0].fields.getString("title"), recordTitle) - - // Download an attachment - val attachmentLocation = records[0].attachment!!.location - val localAttachmentPath = "${tempDir.root}/path.jpg" - setupAttachmentResponses(config, attachmentLocation) - client.downloadAttachmentToPath(attachmentLocation, localAttachmentPath) - val downloadedFile = File(localAttachmentPath) - assertTrue(downloadedFile.exists()) - assertEquals(csv, downloadedFile.readText()) - } - - private fun setupAttachmentResponses( - config: RemoteSettingsConfig, - attachmentLocation: String, - ) { - val topUrl = config.serverUrl - val attachmentUrl = "${config.serverUrl}/attachments/$attachmentLocation" - doFetch = { req -> - when (req.url) { - "$topUrl/" -> { - Response( - url = req.url, - status = 200, - headers = fakeHeaders, - body = Response.Body( - stream = attachmentsInfoJson(topUrl!!).byteInputStream(), - null, - ), - ) - } - attachmentUrl -> { - Response( - url = attachmentUrl, - status = 200, - headers = fakeHeaders, - body = Response.Body( - stream = csv.byteInputStream(), - null, - ), - ) - } - else -> error("unexpected url") - } - } - } - private fun setupRecordResponse( - config: RemoteSettingsConfig, - responseBodyStream: InputStream = recordJson.byteInputStream(), - ) { - fakeUrl = "${config.serverUrl}/v1/buckets/${config.bucketName}/collections/${config.collectionName}/records" - fakeBody = Response.Body(responseBodyStream, null) - } - - private fun attachmentsInfoJson(baseUrl: String) = """ - { - "capabilities": { - "admin": { - "description": "Serves the admin console.", - "url": "https://github.com/Kinto/kinto-admin/", - "version": "2.0.0" - }, - "attachments": { - "description": "Add file attachments to records", - "url": "https://github.com/Kinto/kinto-attachment/", - "version": "6.3.1", - "base_url": "$baseUrl/attachments/" - } - } - } - """.trimIndent() - - private val recordTitle = "with-txt-attachment" - private val recordJson = """ - { - "data": [ - { - "title": "$recordTitle", - "content": "content", - "attachment": { - "filename": "text-attachment.csv", - "location": "the-bucket/the-collection/d3a5eccc-f0ca-42c3-b0bb-c0d4408c21c9.jpg", - "hash": "2cbd593f3fd5f1585f92265433a6696a863bc98726f03e7222135ff0d8e83543", - "mimetype": "text/csv", - "size": 1374325 - }, - "schema": 1677694447771, - "id": "7403c6f9-79be-4e0c-a37a-8f2b5bd7ad58", - "last_modified": 1677694455368 - } - ] - } - """.trimIndent() - - private val csv = """ - John,Doe,120 jefferson st.,Riverside, NJ, 08075 - Jack,McGinnis,220 hobo Av.,Phila, PA,09119 - "John ""Da Man""${'"'},Repici,120 Jefferson St.,Riverside, NJ,08075 - Stephen,Tyler,"7452 Terrace ""At the Plaza"" road",SomeTown,SD, 91234 - ,Blankman,,SomeTown, SD, 00298 - "Joan ""the bone"", Anne",Jet,"9th, at Terrace plc",Desert City,CO,00123 - """.trimIndent() -} diff --git a/third_party/rust/remote_settings/src/client.rs b/third_party/rust/remote_settings/src/client.rs index e84c823e0782..9585a7cc7c57 100644 --- a/third_party/rust/remote_settings/src/client.rs +++ b/third_party/rust/remote_settings/src/client.rs @@ -15,6 +15,7 @@ use url::Url; use viaduct::{Request, Response}; const HEADER_BACKOFF: &str = "Backoff"; +const HEADER_ETAG: &str = "ETag"; const HEADER_RETRY_AFTER: &str = "Retry-After"; /// A simple HTTP client that can retrieve Remote Settings data using the properties by [ClientConfig]. @@ -48,16 +49,7 @@ impl Client { /// bucket, and collection defined by the [ClientConfig] used to generate /// this [Client]. pub fn get_records(&self) -> Result { - let resp = self.get_records_raw()?; - let records = resp.json::()?.data; - let last_modified = resp - .headers - .get_as("etag") - .ok_or_else(|| RemoteSettingsError::ResponseError("no etag header".into()))??; - Ok(RemoteSettingsResponse { - records, - last_modified, - }) + self.get_records_with_options(&GetItemsOptions::new()) } /// Fetches all records for a collection that can be found in the server, @@ -71,14 +63,31 @@ impl Client { /// for a collection that can be found in the server, bucket, and /// collection defined by the [ClientConfig] used to generate this [Client]. pub fn get_records_since(&self, timestamp: u64) -> Result { - let resp = self.get_records_raw_with_options( + self.get_records_with_options( GetItemsOptions::new().gt("last_modified", timestamp.to_string()), - )?; + ) + } + + /// Fetches records from this client's collection with the given options. + pub fn get_records_with_options( + &self, + options: &GetItemsOptions, + ) -> Result { + let resp = self.get_records_raw_with_options(options)?; let records = resp.json::()?.data; - let last_modified = resp + let etag = resp .headers - .get_as("etag") - .ok_or_else(|| RemoteSettingsError::ResponseError("no etag header".into()))??; + .get(HEADER_ETAG) + .ok_or_else(|| RemoteSettingsError::ResponseError("no etag header".into()))?; + // Per https://docs.kinto-storage.org/en/stable/api/1.x/timestamps.html, + // the `ETag` header value is a quoted integer. Trim the quotes before + // parsing. + let last_modified = etag.trim_matches('"').parse().map_err(|_| { + RemoteSettingsError::ResponseError(format!( + "expected quoted integer in etag header; got `{}`", + etag + )) + })?; Ok(RemoteSettingsResponse { records, last_modified, @@ -102,22 +111,32 @@ impl Client { /// Downloads an attachment from [attachment_location]. NOTE: there are no /// guarantees about a maximum size, so use care when fetching potentially /// large attachments. - pub fn get_attachment(&self, attachment_location: &str) -> Result { - let mut current_remote_state = self.remote_state.lock(); - self.ensure_no_backoff(&mut current_remote_state.backoff)?; - let attachments_base_url = match ¤t_remote_state.attachments_base_url { - Some(url) => url.clone(), + pub fn get_attachment(&self, attachment_location: &str) -> Result> { + Ok(self.get_attachment_raw(attachment_location)?.body) + } + + /// Fetches a raw network [Response] for an attachment. + pub fn get_attachment_raw(&self, attachment_location: &str) -> Result { + // Important: We use a `let` binding here to ensure that the mutex is + // unlocked immediately after cloning the URL. If we matched directly on + // the `.lock()` expression, the mutex would stay locked until the end + // of the `match`, causing a deadlock. + let maybe_attachments_base_url = self.remote_state.lock().attachments_base_url.clone(); + + let attachments_base_url = match maybe_attachments_base_url { + Some(attachments_base_url) => attachments_base_url, None => { - let req = Request::get(self.base_url.clone()); - let server_info = req.send()?.json::()?; - match server_info.capabilities.attachments { + let server_info = self + .make_request(self.base_url.clone())? + .json::()?; + let attachments_base_url = match server_info.capabilities.attachments { Some(capability) => Url::parse(&capability.base_url)?, None => Err(RemoteSettingsError::AttachmentsUnsupportedError)?, - } + }; + self.remote_state.lock().attachments_base_url = Some(attachments_base_url.clone()); + attachments_base_url } }; - current_remote_state.attachments_base_url = Some(attachments_base_url.clone()); - drop(current_remote_state); self.make_request(attachments_base_url.join(attachment_location)?) } @@ -187,6 +206,7 @@ impl Client { /// Data structure representing the top-level response from the Remote Settings. /// [last_modified] will be extracted from the etag header of the response. +#[derive(Clone, Debug, Eq, PartialEq)] pub struct RemoteSettingsResponse { pub records: Vec, pub last_modified: u64, @@ -203,6 +223,8 @@ struct RecordsResponse { pub struct RemoteSettingsRecord { pub id: String, pub last_modified: u64, + #[serde(default)] + pub deleted: bool, pub attachment: Option, #[serde(flatten)] pub fields: RsJsonObject, @@ -485,6 +507,7 @@ impl Sort { #[cfg(test)] mod test { use super::*; + use expect_test::expect; use mockito::{mock, Matcher}; #[test] fn test_defaults() { @@ -528,11 +551,13 @@ mod test { }; let client = Client::new(config).unwrap(); - let resp = client.get_attachment(attachment_location).unwrap(); + let first_resp = client.get_attachment(attachment_location).unwrap(); + let second_resp = client.get_attachment(attachment_location).unwrap(); server_info_m.expect(1).assert(); - attachment_m.expect(1).assert(); - assert_eq!(resp.body, attachment_bytes); + attachment_m.expect(2).assert(); + assert_eq!(first_resp, attachment_bytes); + assert_eq!(second_resp, attachment_bytes); } #[test] @@ -582,7 +607,7 @@ mod test { .with_status(200) .with_header("content-type", "application/json") .with_header("Backoff", "60") - .with_header("etag", "1000") + .with_header("etag", "\"1000\"") .create(); let config = RemoteSettingsConfig { server_url: Some(mockito::server_url()), @@ -651,7 +676,7 @@ mod test { .with_body(response_body()) .with_status(200) .with_header("content-type", "application/json") - .with_header("etag", "1000") + .with_header("etag", "\"1000\"") .create(); let config = RemoteSettingsConfig { server_url: Some(mockito::server_url()), @@ -659,28 +684,110 @@ mod test { bucket_name: Some(String::from("the-bucket")), }; let http_client = Client::new(config).unwrap(); - assert!(http_client - .get_records_raw_with_options( - GetItemsOptions::new() - .field("a") - .field("c") - .field("b") - .eq("a", "b") - .lt("c.d", "5") - .gt("e", "15") - .max("f", "20") - .min("g", "10") - .not("h", "i") - .like("j", "*k*") - .has("l") - .has_not("m") - .contains("n", "o") - .sort("b", SortOrder::Descending) - .sort("a", SortOrder::Ascending) - .limit(3) - ) - .is_ok()); - m.expect(1).assert(); + let mut options = GetItemsOptions::new(); + options + .field("a") + .field("c") + .field("b") + .eq("a", "b") + .lt("c.d", "5") + .gt("e", "15") + .max("f", "20") + .min("g", "10") + .not("h", "i") + .like("j", "*k*") + .has("l") + .has_not("m") + .contains("n", "o") + .sort("b", SortOrder::Descending) + .sort("a", SortOrder::Ascending) + .limit(3); + + assert!(http_client.get_records_raw_with_options(&options).is_ok()); + expect![[r#" + RemoteSettingsResponse { + records: [ + RemoteSettingsRecord { + id: "c5dcd1da-7126-4abb-846b-ec85b0d4d0d7", + last_modified: 1677694949407, + deleted: false, + attachment: Some( + Attachment { + filename: "jgp-attachment.jpg", + mimetype: "image/jpeg", + location: "the-bucket/the-collection/d3a5eccc-f0ca-42c3-b0bb-c0d4408c21c9.jpg", + hash: "2cbd593f3fd5f1585f92265433a6696a863bc98726f03e7222135ff0d8e83543", + size: 1374325, + }, + ), + fields: { + "content": String( + "content", + ), + "schema": Number( + 1677694447771, + ), + "title": String( + "jpg-attachment", + ), + }, + }, + RemoteSettingsRecord { + id: "ff301910-6bf5-4cfe-bc4c-5c80308661a5", + last_modified: 1677694470354, + deleted: false, + attachment: Some( + Attachment { + filename: "pdf-attachment.pdf", + mimetype: "application/pdf", + location: "the-bucket/the-collection/5f7347c2-af92-411d-a65b-f794f9b5084c.pdf", + hash: "de1cde3571ef3faa77ea0493276de9231acaa6f6651602e93aa1036f51181e9b", + size: 157, + }, + ), + fields: { + "content": String( + "content", + ), + "schema": Number( + 1677694447771, + ), + "title": String( + "with-attachment", + ), + }, + }, + RemoteSettingsRecord { + id: "7403c6f9-79be-4e0c-a37a-8f2b5bd7ad58", + last_modified: 1677694455368, + deleted: false, + attachment: None, + fields: { + "content": String( + "content", + ), + "schema": Number( + 1677694447771, + ), + "title": String( + "no-attachment", + ), + }, + }, + RemoteSettingsRecord { + id: "9320f53c-0a39-4997-9120-62ff597ffb26", + last_modified: 1690921847416, + deleted: true, + attachment: None, + fields: {}, + }, + ], + last_modified: 1000, + } + "#]].assert_debug_eq(&http_client + .get_records_with_options(&options) + .unwrap()); + m.expect(2).assert(); } #[test] @@ -693,7 +800,7 @@ mod test { .with_body(response_body()) .with_status(200) .with_header("content-type", "application/json") - .with_header("etag", "1000") + .with_header("etag", "\"1000\"") .create(); let config = RemoteSettingsConfig { server_url: Some(mockito::server_url()), @@ -723,6 +830,166 @@ mod test { m.expect(1).assert(); } + #[test] + fn test_record_fields() { + viaduct_reqwest::use_reqwest_backend(); + let m = mock( + "GET", + "/v1/buckets/the-bucket/collections/the-collection/records", + ) + .with_body(response_body()) + .with_status(200) + .with_header("content-type", "application/json") + .with_header("etag", "\"1000\"") + .create(); + let config = RemoteSettingsConfig { + server_url: Some(mockito::server_url()), + collection_name: String::from("the-collection"), + bucket_name: Some(String::from("the-bucket")), + }; + let http_client = Client::new(config).unwrap(); + let response = http_client.get_records().unwrap(); + expect![[r#" + RemoteSettingsResponse { + records: [ + RemoteSettingsRecord { + id: "c5dcd1da-7126-4abb-846b-ec85b0d4d0d7", + last_modified: 1677694949407, + deleted: false, + attachment: Some( + Attachment { + filename: "jgp-attachment.jpg", + mimetype: "image/jpeg", + location: "the-bucket/the-collection/d3a5eccc-f0ca-42c3-b0bb-c0d4408c21c9.jpg", + hash: "2cbd593f3fd5f1585f92265433a6696a863bc98726f03e7222135ff0d8e83543", + size: 1374325, + }, + ), + fields: { + "content": String( + "content", + ), + "schema": Number( + 1677694447771, + ), + "title": String( + "jpg-attachment", + ), + }, + }, + RemoteSettingsRecord { + id: "ff301910-6bf5-4cfe-bc4c-5c80308661a5", + last_modified: 1677694470354, + deleted: false, + attachment: Some( + Attachment { + filename: "pdf-attachment.pdf", + mimetype: "application/pdf", + location: "the-bucket/the-collection/5f7347c2-af92-411d-a65b-f794f9b5084c.pdf", + hash: "de1cde3571ef3faa77ea0493276de9231acaa6f6651602e93aa1036f51181e9b", + size: 157, + }, + ), + fields: { + "content": String( + "content", + ), + "schema": Number( + 1677694447771, + ), + "title": String( + "with-attachment", + ), + }, + }, + RemoteSettingsRecord { + id: "7403c6f9-79be-4e0c-a37a-8f2b5bd7ad58", + last_modified: 1677694455368, + deleted: false, + attachment: None, + fields: { + "content": String( + "content", + ), + "schema": Number( + 1677694447771, + ), + "title": String( + "no-attachment", + ), + }, + }, + RemoteSettingsRecord { + id: "9320f53c-0a39-4997-9120-62ff597ffb26", + last_modified: 1690921847416, + deleted: true, + attachment: None, + fields: {}, + }, + ], + last_modified: 1000, + } + "#]].assert_debug_eq(&response); + m.expect(1).assert(); + } + + #[test] + fn test_missing_etag() { + viaduct_reqwest::use_reqwest_backend(); + let m = mock( + "GET", + "/v1/buckets/the-bucket/collections/the-collection/records", + ) + .with_body(response_body()) + .with_status(200) + .with_header("content-type", "application/json") + .create(); + + let config = RemoteSettingsConfig { + server_url: Some(mockito::server_url()), + bucket_name: Some(String::from("the-bucket")), + collection_name: String::from("the-collection"), + }; + let client = Client::new(config).unwrap(); + + let err = client.get_records().unwrap_err(); + assert!( + matches!(err, RemoteSettingsError::ResponseError(_)), + "Want response error for missing `ETag`; got {}", + err + ); + m.expect(1).assert(); + } + + #[test] + fn test_invalid_etag() { + viaduct_reqwest::use_reqwest_backend(); + let m = mock( + "GET", + "/v1/buckets/the-bucket/collections/the-collection/records", + ) + .with_body(response_body()) + .with_status(200) + .with_header("content-type", "application/json") + .with_header("etag", "bad!") + .create(); + + let config = RemoteSettingsConfig { + server_url: Some(mockito::server_url()), + bucket_name: Some(String::from("the-bucket")), + collection_name: String::from("the-collection"), + }; + let client = Client::new(config).unwrap(); + + let err = client.get_records().unwrap_err(); + assert!( + matches!(err, RemoteSettingsError::ResponseError(_)), + "Want response error for invalid `ETag`; got {}", + err + ); + m.expect(1).assert(); + } + fn attachment_metadata(base_url: String) -> String { format!( r#" @@ -763,12 +1030,13 @@ mod test { r#" {{ "data": [ + {}, {}, {}, {} ] }}"#, - JPG_ATTACHMENT, PDF_ATTACHMENT, NO_ATTACHMENT + JPG_ATTACHMENT, PDF_ATTACHMENT, NO_ATTACHMENT, TOMBSTONE ) } @@ -815,4 +1083,12 @@ mod test { "last_modified": 1677694455368 } "#; + + const TOMBSTONE: &str = r#" + { + "id": "9320f53c-0a39-4997-9120-62ff597ffb26", + "last_modified": 1690921847416, + "deleted": true + } + "#; } diff --git a/third_party/rust/remote_settings/src/error.rs b/third_party/rust/remote_settings/src/error.rs index 435441e579b5..120681871baf 100644 --- a/third_party/rust/remote_settings/src/error.rs +++ b/third_party/rust/remote_settings/src/error.rs @@ -8,8 +8,6 @@ pub enum RemoteSettingsError { JSONError(#[from] serde_json::Error), #[error("Error writing downloaded attachment: {0}")] FileError(#[from] std::io::Error), - #[error("ParseIntError: {0}")] - ParseIntError(#[from] std::num::ParseIntError), /// An error has occured while sending a request. #[error("Error sending request: {0}")] RequestError(#[from] viaduct::Error), diff --git a/third_party/rust/remote_settings/src/lib.rs b/third_party/rust/remote_settings/src/lib.rs index 7543ede100aa..9aa6ecbf1a7e 100644 --- a/third_party/rust/remote_settings/src/lib.rs +++ b/third_party/rust/remote_settings/src/lib.rs @@ -45,7 +45,7 @@ impl RemoteSettings { ) -> Result<()> { let resp = self.client.get_attachment(&attachment_location)?; let mut file = File::create(path)?; - file.write_all(&resp.body)?; + file.write_all(&resp)?; Ok(()) } } @@ -66,7 +66,7 @@ mod test { .with_body(response_body()) .with_status(200) .with_header("content-type", "application/json") - .with_header("etag", "1000") + .with_header("etag", "\"1000\"") .create(); let config = RemoteSettingsConfig { @@ -94,7 +94,7 @@ mod test { .with_body(response_body()) .with_status(200) .with_header("content-type", "application/json") - .with_header("etag", "1000") + .with_header("etag", "\"1000\"") .create(); let config = RemoteSettingsConfig { diff --git a/third_party/rust/remote_settings/src/remote_settings.udl b/third_party/rust/remote_settings/src/remote_settings.udl index d19a64560770..bb52874211aa 100644 --- a/third_party/rust/remote_settings/src/remote_settings.udl +++ b/third_party/rust/remote_settings/src/remote_settings.udl @@ -21,6 +21,7 @@ dictionary RemoteSettingsResponse { dictionary RemoteSettingsRecord { string id; u64 last_modified; + boolean deleted; Attachment? attachment; RsJsonObject fields; }; @@ -37,7 +38,6 @@ dictionary Attachment { enum RemoteSettingsError { "JSONError", "FileError", - "ParseIntError", "RequestError", "UrlParsingError", "BackoffError", diff --git a/third_party/rust/sql-support/.cargo-checksum.json b/third_party/rust/sql-support/.cargo-checksum.json index c61e0a74f624..21ae8c19c546 100644 --- a/third_party/rust/sql-support/.cargo-checksum.json +++ b/third_party/rust/sql-support/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"e679992b7cf7d42cdbc5d6350c512ca448a273767003db600ef8099c7182bd99","build.rs":"d89f20669c2e243652630ce025199d187d2a128be6a626a02e0679bd74a2ad5a","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":"dcc7140095f9ba20442b5e6294d8af924d54588837cf2ce019dff013fa198783","src/repeat.rs":"b4c5ff5d083afba7f9f153f54aba2e6859b78b85c82d48dbd6bd58f67da9e6b9"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"e679992b7cf7d42cdbc5d6350c512ca448a273767003db600ef8099c7182bd99","build.rs":"d89f20669c2e243652630ce025199d187d2a128be6a626a02e0679bd74a2ad5a","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} \ No newline at end of file diff --git a/third_party/rust/sql-support/src/open_database.rs b/third_party/rust/sql-support/src/open_database.rs index 43c0d3f30db0..6c49471d29d9 100644 --- a/third_party/rust/sql-support/src/open_database.rs +++ b/third_party/rust/sql-support/src/open_database.rs @@ -22,6 +22,8 @@ /// it and call prepare(), upgrade_from() for each upgrade that needs to be applied, then /// finish(). As above, a read-only connection will panic if upgrades are necessary, so /// you should ensure the first connection opened is writable. +/// - If the database file is corrupt, or upgrade_from() returns [`Error::Corrupt`], the +/// database file will be removed and replaced with a new DB. /// - If the connection is not writable, `finish()` will be called (ie, `finish()`, like /// `prepare()`, is called for all connections) /// @@ -38,11 +40,25 @@ use thiserror::Error; pub enum Error { #[error("Incompatible database version: {0}")] IncompatibleVersion(u32), + #[error("Database is corrupt")] + Corrupt, #[error("Error executing SQL: {0}")] - SqlError(#[from] rusqlite::Error), - // `.0` is the original `Error` in string form. - #[error("Failed to recover a corrupt database ('{0}') due to an error deleting the file: {1}")] - RecoveryError(String, std::io::Error), + SqlError(rusqlite::Error), + #[error("Failed to recover a corrupt database due to an error deleting the file: {0}")] + RecoveryError(std::io::Error), +} + +impl From for Error { + fn from(value: rusqlite::Error) -> Self { + match value { + RusqliteError::SqliteFailure(e, _) + if matches!(e.code, ErrorCode::DatabaseCorrupt | ErrorCode::NotADatabase) => + { + Self::Corrupt + } + _ => Self::SqlError(value), + } + } } pub type Result = std::result::Result; @@ -189,12 +205,7 @@ fn try_handle_db_failure>( return Err(err); } - let delete = match err { - Error::SqlError(RusqliteError::SqliteFailure(e, _)) => { - matches!(e.code, ErrorCode::DatabaseCorrupt | ErrorCode::NotADatabase) - } - _ => false, - }; + let delete = matches!(err, Error::Corrupt); if delete { log::info!( "{}: the database is fatally damaged; deleting and starting fresh", @@ -204,7 +215,7 @@ fn try_handle_db_failure>( // identify any value there - actually getting our hands on the file from a mobile device // is tricky and it would just take up disk space forever. if let Err(io_err) = std::fs::remove_file(path) { - return Err(Error::RecoveryError(err.to_string(), io_err)); + return Err(Error::RecoveryError(io_err)); } Ok(()) } else { @@ -364,6 +375,12 @@ mod test { fn upgrade_from(&self, conn: &Transaction<'_>, version: u32) -> Result<()> { match version { + // This upgrade forces the database to be replaced by returning + // `Error::Corrupt`. + 1 => { + self.push_call("upgrade_from_v1"); + Err(Error::Corrupt) + } 2 => { self.push_call("upgrade_from_v2"); conn.execute_batch( @@ -404,6 +421,13 @@ mod test { } } + // A special schema used to test the upgrade that forces the database to be + // replaced. + static INIT_V1: &str = " + CREATE TABLE prep_table(col); + PRAGMA user_version=1; + "; + // Initialize the database to v2 to test upgrading from there static INIT_V2: &str = " CREATE TABLE prep_table(col); @@ -533,4 +557,18 @@ mod test { // just check the file is no longer what it was before. assert_ne!(metadata.len(), 7); } + + #[test] + fn test_force_replace() { + let db_file = MigratedDatabaseFile::new(TestConnectionInitializer::new(), INIT_V1); + let conn = open_database(db_file.path.clone(), &db_file.connection_initializer).unwrap(); + check_final_data(&conn); + db_file.connection_initializer.check_calls(vec![ + "prep", + "upgrade_from_v1", + "prep", + "init", + "finish", + ]); + } } diff --git a/third_party/rust/suggest/.cargo-checksum.json b/third_party/rust/suggest/.cargo-checksum.json index 3b47783a9d84..9fb1554368c6 100644 --- a/third_party/rust/suggest/.cargo-checksum.json +++ b/third_party/rust/suggest/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"2a7334dc6420c7f7d1c14affaee132fb355e96ae94463153db72d7d5a316efd7","README.md":"8d7457893194e255b87e5a2667ee25c87bd470f5338d7078506f866a67a3fdbd","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/db.rs":"9ad7fe53861ccfa01ccda1aa2132154a7967f7ef729709a52c940a4ea9ab2539","src/error.rs":"f47763a1a5d228b446eb8f718433e49fdb1c7b304de1255891215144dddd7a43","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"831fd8e3881be06c560d502357188d143a2774e19b371cc40c40c2378810297b","src/rs.rs":"9e8e937306615c1e173143083d4a5b526a1c0c2b28092305ecd4dfe6c665f851","src/schema.rs":"962b9f5916089d6656de77afcc81e51cb81310f8dbcb9bbaa248b26a1d087332","src/store.rs":"d04edba77295f3a96af18668a1851fd1b4afe5ae449b8b1a14cd47e25151fd51","src/suggest.udl":"8035e6261e55d5e37366f219f5806b842cc2f91dffd39e3ba9bfa9484e22fd6c","uniffi.toml":"fb8add80c2f660e4eacf95ec3f0b1d0f6a92ab5dbcf607782350442814ee26a7"},"package":null} \ No newline at end of file +{"files":{"Cargo.toml":"7c19ff48428dd00ea709c254f1aa44627dd5d0f30d0741285f27a6f4a6200e1f","README.md":"8d7457893194e255b87e5a2667ee25c87bd470f5338d7078506f866a67a3fdbd","build.rs":"78780c5cccfe22c3ff4198624b9e188559c437c3e6fa1c8bb66548eee6aa66bf","src/db.rs":"f40754ac33ff111b5165ed271064de8248acd2d39ac67aed92cbbda2826f45fe","src/error.rs":"f47763a1a5d228b446eb8f718433e49fdb1c7b304de1255891215144dddd7a43","src/keyword.rs":"988d0ab021c0df19cfd3c519df7d37f606bf984cd14d0efca4e5a7aff88344dd","src/lib.rs":"1294435de3ed1de26f7fe7e9a5760bcb1fe06c9c51f308c1f63666f96ba59ae5","src/provider.rs":"8aa8e41dfc64bb0adc24ed7f07a2687130bc59710cece2bd981a8b9e4e4a3594","src/rs.rs":"474fee04323c5c2881e679f57bea318c9ba2faa1873ce8f24abc4d92775dd7b4","src/schema.rs":"9e383221bdb11d84f4d1f2e7a7034983154917c92c5ed25b75fce5f5bf8fd159","src/store.rs":"7affafe7d9396821ff6bd19321837d1cb2e4ecc009880804e704d8cfcfca898f","src/suggest.udl":"d7a5ba8edf0f56affa8ac5be0b6111736840a56e1057cd7125c996da21e3d984","src/suggestion.rs":"053637820aaae3869005e5906bd29edb002f2e9b18172ee271e0c2aec35cd028","uniffi.toml":"fb8add80c2f660e4eacf95ec3f0b1d0f6a92ab5dbcf607782350442814ee26a7"},"package":null} \ No newline at end of file diff --git a/third_party/rust/suggest/Cargo.toml b/third_party/rust/suggest/Cargo.toml index a78fc21ce5cb..e28b377f2396 100644 --- a/third_party/rust/suggest/Cargo.toml +++ b/third_party/rust/suggest/Cargo.toml @@ -48,11 +48,15 @@ path = "../support/sql" [dev-dependencies] expect-test = "1.4" +hex = "0.4" [dev-dependencies.env_logger] version = "0.7" default-features = false +[dev-dependencies.rc_crypto] +path = "../support/rc_crypto" + [build-dependencies.uniffi] version = "0.24.1" features = ["build"] diff --git a/third_party/rust/suggest/src/db.rs b/third_party/rust/suggest/src/db.rs index 5db2a60d33e3..cd649903bf7d 100644 --- a/third_party/rust/suggest/src/db.rs +++ b/third_party/rust/suggest/src/db.rs @@ -16,7 +16,8 @@ use sql_support::{open_database::open_database_with_flags, ConnExt}; use crate::{ keyword::full_keyword, - rs::{DownloadedSuggestion, SuggestRecordId}, + provider::SuggestionProvider, + rs::{DownloadedAmpWikipediaSuggestion, SuggestRecordId}, schema::SuggestConnectionInitializer, Result, Suggestion, }; @@ -25,10 +26,6 @@ use crate::{ /// from the Suggest Remote Settings collection. pub const LAST_INGEST_META_KEY: &str = "last_quicksuggest_ingest"; -/// A list of [`Suggestion::iab_category`] values used to distinguish -/// non-sponsored suggestions. -pub const NONSPONSORED_IAB_CATEGORIES: &[&str] = &["5 - Education"]; - /// The database connection type. #[derive(Clone, Copy)] pub(crate) enum ConnectionType { @@ -122,9 +119,7 @@ impl<'a> SuggestDao<'a> { /// Fetches suggestions that match the given keyword from the database. pub fn fetch_by_keyword(&self, keyword: &str) -> Result> { self.conn.query_rows_and_then_cached( - "SELECT s.id, k.rank, s.block_id, s.advertiser, s.iab_category, - s.title, s.url, s.impression_url, s.click_url, - (SELECT i.data FROM icons i WHERE i.id = s.icon_id) AS icon + "SELECT s.id, k.rank, s.title, s.url, s.provider FROM suggestions s JOIN keywords k ON k.suggestion_id = s.id WHERE k.keyword = :keyword @@ -132,83 +127,157 @@ impl<'a> SuggestDao<'a> { named_params! { ":keyword": keyword, }, - |row| -> Result { - let keywords: Vec = self.conn.query_rows_and_then( + |row| -> Result{ + let suggestion_id: i64 = row.get("id")?; + let title = row.get("title")?; + let url = row.get("url")?; + let provider = row.get("provider")?; + + let keywords: Vec = self.conn.query_rows_and_then_cached( "SELECT keyword FROM keywords WHERE suggestion_id = :suggestion_id AND rank >= :rank ORDER BY rank ASC", named_params! { - ":suggestion_id": row.get::<_, i64>("id")?, + ":suggestion_id": suggestion_id, ":rank": row.get::<_, i64>("rank")?, }, |row| row.get(0), )?; - let iab_category = row.get::<_, String>("iab_category")?; - let is_sponsored = !NONSPONSORED_IAB_CATEGORIES.contains(&iab_category.as_str()); - Ok(Suggestion { - block_id: row.get("block_id")?, - advertiser: row.get("advertiser")?, - iab_category, - is_sponsored, - title: row.get("title")?, - url: row.get("url")?, - full_keyword: full_keyword(keyword, &keywords), - icon: row.get("icon")?, - impression_url: row.get("impression_url")?, - click_url: row.get("click_url")?, - }) + + match provider { + SuggestionProvider::Amp => { + self.conn.query_row_and_then( + "SELECT amp.advertiser, amp.block_id, amp.iab_category, amp.impression_url, amp.click_url, + (SELECT i.data FROM icons i WHERE i.id = amp.icon_id) AS icon + FROM amp_custom_details amp + WHERE amp.suggestion_id = :suggestion_id", + named_params! { + ":suggestion_id": suggestion_id + }, + |row| { + Ok(Suggestion::Amp { + block_id: row.get("block_id")?, + advertiser: row.get("advertiser")?, + iab_category: row.get("iab_category")?, + title, + url, + full_keyword: full_keyword(keyword, &keywords), + icon: row.get("icon")?, + impression_url: row.get("impression_url")?, + click_url: row.get("click_url")?, + }) + } + ) + }, + SuggestionProvider::Wikipedia => { + let icon = self.conn.try_query_one( + "SELECT i.data + 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, + )?; + Ok(Suggestion::Wikipedia { + title, + url, + full_keyword: full_keyword(keyword, &keywords), + icon, + }) + } + } }, ) } - /// Inserts all suggestions associated with a Remote Settings record into + /// Inserts all suggestions from a downloaded AMP-Wikipedia attachment into /// the database. - pub fn insert_suggestions( + pub fn insert_amp_wikipedia_suggestions( &mut self, record_id: &SuggestRecordId, - suggestions: &[DownloadedSuggestion], + suggestions: &[DownloadedAmpWikipediaSuggestion], ) -> Result<()> { for suggestion in suggestions { self.scope.err_if_interrupted()?; + let common_details = suggestion.common_details(); + let provider = suggestion.provider(); let suggestion_id: i64 = self.conn.query_row_and_then_cachable( "INSERT INTO suggestions( record_id, - block_id, - advertiser, - iab_category, + provider, title, - url, - icon_id, - impression_url, - click_url + url ) VALUES( :record_id, - :block_id, - :advertiser, - :iab_category, + :provider, :title, - :url, - :icon_id, - :impression_url, - :click_url + :url ) - RETURNING id", + RETURNING id + ", named_params! { ":record_id": record_id.as_str(), - ":block_id": suggestion.block_id, - ":advertiser": suggestion.advertiser, - ":iab_category": suggestion.iab_category, - ":title": suggestion.title, - ":url": suggestion.url, - ":icon_id": suggestion.icon_id, - ":impression_url": suggestion.impression_url, - ":click_url": suggestion.click_url, + ":provider": &provider, + ":title": common_details.title, + ":url": common_details.url, + }, |row| row.get(0), true, )?; - for (index, keyword) in suggestion.keywords.iter().enumerate() { + match suggestion { + DownloadedAmpWikipediaSuggestion::Amp(amp) => { + self.conn.execute( + "INSERT INTO amp_custom_details( + suggestion_id, + advertiser, + block_id, + iab_category, + impression_url, + click_url, + icon_id + ) + VALUES( + :suggestion_id, + :advertiser, + :block_id, + :iab_category, + :impression_url, + :click_url, + :icon_id + )", + named_params! { + ":suggestion_id": suggestion_id, + ":advertiser": amp.advertiser, + ":block_id": amp.block_id, + ":iab_category": amp.iab_category, + ":impression_url": amp.impression_url, + ":click_url": amp.click_url, + ":icon_id": amp.icon_id, + }, + )?; + } + DownloadedAmpWikipediaSuggestion::Wikipedia(wikipedia) => { + self.conn.execute( + "INSERT INTO wikipedia_custom_details( + suggestion_id, + icon_id + ) + VALUES( + :suggestion_id, + :icon_id + )", + named_params! { + ":suggestion_id": suggestion_id, + ":icon_id": wikipedia.icon_id, + }, + )?; + } + } + for (index, keyword) in common_details.keywords.iter().enumerate() { self.conn.execute( "INSERT INTO keywords( keyword, @@ -231,10 +300,10 @@ impl<'a> SuggestDao<'a> { Ok(()) } - /// Inserts an icon for a suggestion into the database. - pub fn insert_icon(&mut self, icon_id: &str, data: &[u8]) -> Result<()> { + /// Inserts or replaces an icon for a suggestion into the database. + pub fn put_icon(&mut self, icon_id: &str, data: &[u8]) -> Result<()> { self.conn.execute( - "INSERT INTO icons( + "INSERT OR REPLACE INTO icons( id, data ) @@ -291,7 +360,7 @@ impl<'a> SuggestDao<'a> { /// Sets the value for a metadata key. pub fn put_meta(&mut self, key: &str, value: impl ToSql) -> Result<()> { self.conn.execute_cached( - "REPLACE INTO meta(key, value) VALUES(:key, :value)", + "INSERT OR REPLACE INTO meta(key, value) VALUES(:key, :value)", named_params! { ":key": key, ":value": value }, )?; Ok(()) diff --git a/third_party/rust/suggest/src/lib.rs b/third_party/rust/suggest/src/lib.rs index 6710fdd57ce9..0c9f5d091146 100644 --- a/third_party/rust/suggest/src/lib.rs +++ b/third_party/rust/suggest/src/lib.rs @@ -4,35 +4,23 @@ */ use remote_settings::RemoteSettingsConfig; - mod db; mod error; mod keyword; +mod provider; mod rs; mod schema; mod store; +mod suggestion; pub use error::SuggestApiError; +pub use provider::SuggestionProvider; pub use store::{SuggestIngestionConstraints, SuggestStore}; +pub use suggestion::Suggestion; pub(crate) type Result = std::result::Result; pub type SuggestApiResult = std::result::Result; -/// A suggestion from the database to show in the address bar. -#[derive(Clone, Debug, Eq, Hash, PartialEq)] -pub struct Suggestion { - pub block_id: i64, - pub advertiser: String, - pub iab_category: String, - pub is_sponsored: bool, - pub full_keyword: String, - pub title: String, - pub url: String, - pub icon: Option>, - pub impression_url: Option, - pub click_url: Option, -} - /// A query for suggestions to show in the address bar. #[derive(Debug, Default)] pub struct SuggestionQuery { diff --git a/third_party/rust/suggest/src/provider.rs b/third_party/rust/suggest/src/provider.rs new file mode 100644 index 000000000000..ac8e3feb7eb2 --- /dev/null +++ b/third_party/rust/suggest/src/provider.rs @@ -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 rusqlite::{ + types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput, ValueRef}, + Result as RusqliteResult, +}; + +/// A provider is a source of search suggestions. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] +#[repr(u8)] +pub enum SuggestionProvider { + Amp = 1, + Wikipedia = 2, +} + +impl FromSql for SuggestionProvider { + fn column_result(value: ValueRef<'_>) -> FromSqlResult { + let v = value.as_i64()?; + u8::try_from(v) + .ok() + .and_then(SuggestionProvider::from_u8) + .ok_or_else(|| FromSqlError::OutOfRange(v)) + } +} + +impl SuggestionProvider { + #[inline] + pub(crate) fn from_u8(v: u8) -> Option { + match v { + 1 => Some(SuggestionProvider::Amp), + 2 => Some(SuggestionProvider::Wikipedia), + _ => None, + } + } +} + +impl ToSql for SuggestionProvider { + fn to_sql(&self) -> RusqliteResult> { + Ok(ToSqlOutput::from(*self as u8)) + } +} diff --git a/third_party/rust/suggest/src/rs.rs b/third_party/rust/suggest/src/rs.rs index ebdfa7aa85d4..40549e707589 100644 --- a/third_party/rust/suggest/src/rs.rs +++ b/third_party/rust/suggest/src/rs.rs @@ -1,9 +1,40 @@ -use std::ops::Deref; +/* 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 remote_settings::{Attachment, GetItemsOptions}; -use serde::Deserialize; +//! Crate-internal types for interacting with Remote Settings (`rs`). Types in +//! this module describe records and attachments in the Suggest Remote Settings +//! collection. +//! +//! To add a new suggestion `T` to this component, you'll generally need to: +//! +//! 1. Add a variant named `T` to [`SuggestRecord`]. The variant must have a +//! `#[serde(rename)]` attribute that matches the suggestion record's +//! `type` field. +//! 2. Define a `DownloadedTSuggestion` type with the new suggestion's fields, +//! matching their attachment's schema. Your new type must derive or +//! implement [`serde::Deserialize`]. +//! 3. Update the database schema in the [`schema`] module to store the new +//! suggestion. +//! 4. Add an `insert_t_suggestions()` method to [`db::SuggestDao`] that +//! inserts `DownloadedTSuggestion`s into the database. +//! 5. Update [`store::SuggestStoreInner::ingest()`] to download, deserialize, +//! and store the new suggestion. +//! 6. Add a variant named `T` to [`suggestion::Suggestion`], with the fields +//! that you'd like to expose to the application. These can be the same +//! fields as `DownloadedTSuggestion`, or slightly different, depending on +//! what the application needs to show the suggestion. +//! 7. Update any [`db::SuggestDao`] methods that query the database to include +//! the new suggestion in their results, and return `Suggestion::T` variants +//! as needed. -use crate::Result; +use std::borrow::Cow; + +use remote_settings::{GetItemsOptions, RemoteSettingsResponse}; +use serde::{Deserialize, Deserializer}; + +use crate::{provider::SuggestionProvider, Result}; /// The Suggest Remote Settings collection name. pub(crate) const REMOTE_SETTINGS_COLLECTION: &str = "quicksuggest"; @@ -19,119 +50,72 @@ pub(crate) const SUGGESTIONS_PER_ATTACHMENT: u64 = 200; /// This trait lets tests use a mock client. pub(crate) trait SuggestRemoteSettingsClient { /// Fetches records from the Suggest Remote Settings collection. - fn get_records_with_options( - &self, - options: &GetItemsOptions, - ) -> Result; + fn get_records_with_options(&self, options: &GetItemsOptions) + -> Result; - /// Fetches a data attachment with suggestions to ingest from the Suggest - /// Remote Settings collection. - fn get_data_attachment(&self, location: &str) -> Result; - - /// Fetches an icon attachment from the Suggest Remote Settings collection. - fn get_icon_attachment(&self, location: &str) -> Result>; + /// Fetches a record's attachment from the Suggest Remote Settings + /// collection. + fn get_attachment(&self, location: &str) -> Result>; } impl SuggestRemoteSettingsClient for remote_settings::Client { fn get_records_with_options( &self, options: &GetItemsOptions, - ) -> Result { - Ok(self.get_records_raw_with_options(options)?.json()?) + ) -> Result { + Ok(remote_settings::Client::get_records_with_options( + self, options, + )?) } - fn get_data_attachment(&self, location: &str) -> Result { - Ok(self.get_attachment(location)?.json()?) - } - - fn get_icon_attachment(&self, location: &str) -> Result> { - Ok(self.get_attachment(location)?.body) + fn get_attachment(&self, location: &str) -> Result> { + Ok(remote_settings::Client::get_attachment(self, location)?) } } -/// The response body for a Suggest Remote Settings collection request. -#[derive(Clone, Debug, Deserialize)] -pub(crate) struct SuggestRemoteSettingsRecords { - pub data: Vec, -} - -/// A record with a known or an unknown type, or a tombstone, in the Suggest -/// Remote Settings collection. +/// A record in the Suggest Remote Settings collection. /// -/// Because `#[serde(other)]` doesn't support associated data -/// (serde-rs/serde#1973), we can't define variants for all the known types and -/// the unknown type in the same enum. Instead, we have this "outer", untagged -/// `SuggestRecord` with the "unknown type" variant, and an "inner", internally -/// tagged `TypedSuggestRecord` with all the "known type" variants. -#[derive(Clone, Debug, Deserialize, PartialEq)] -#[serde(untagged)] -pub(crate) enum SuggestRecord { - /// A record with a known type. - Typed(TypedSuggestRecord), - - /// A tombstone, or a record with an unknown type, that we don't know how - /// to ingest. - /// - /// Tombstones only have these three fields, with `deleted` set to `true`. - /// Records with unknown types have `deleted` set to `false`, and may - /// contain other fields that we ignore. - Untyped { - id: SuggestRecordId, - last_modified: u64, - #[serde(default)] - deleted: bool, - }, -} - -/// A record that we know how to ingest from Remote Settings. +/// Except for the type, Suggest records don't carry additional fields. All +/// suggestions are stored in each record's attachment. #[derive(Clone, Debug, Deserialize, PartialEq)] #[serde(tag = "type")] -pub(crate) enum TypedSuggestRecord { +pub(crate) enum SuggestRecord { #[serde(rename = "icon")] - Icon { - id: SuggestRecordId, - last_modified: u64, - attachment: Attachment, - }, + Icon, #[serde(rename = "data")] - Data { - id: SuggestRecordId, - last_modified: u64, - attachment: Attachment, - }, + AmpWikipedia, } /// Represents either a single value, or a list of values. This is used to -/// deserialize downloaded data attachments. +/// deserialize downloaded attachments. #[derive(Clone, Debug, Deserialize)] #[serde(untagged)] -pub(crate) enum OneOrMany { +enum OneOrMany { One(T), Many(Vec), } -impl Deref for OneOrMany { - type Target = [T]; +/// A downloaded Remote Settings attachment that contains suggestions. +#[derive(Clone, Debug, Deserialize)] +#[serde(transparent)] +pub(crate) struct SuggestAttachment(OneOrMany); - fn deref(&self) -> &Self::Target { - match self { +impl SuggestAttachment { + /// Returns a slice of suggestions to ingest from the downloaded attachment. + pub fn suggestions(&self) -> &[T] { + match &self.0 { OneOrMany::One(value) => std::slice::from_ref(value), OneOrMany::Many(values) => values, } } } -/// The contents of a downloaded [`TypedSuggestRecord::Data`] attachment. -#[derive(Clone, Debug, Deserialize)] -#[serde(transparent)] -pub(crate) struct DownloadedSuggestDataAttachment(pub OneOrMany); - /// The ID of a record in the Suggest Remote Settings collection. #[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd)] #[serde(transparent)] -pub(crate) struct SuggestRecordId(String); +pub(crate) struct SuggestRecordId<'a>(Cow<'a, str>); -impl SuggestRecordId { +impl<'a> SuggestRecordId<'a> { pub fn as_str(&self) -> &str { &self.0 } @@ -146,18 +130,107 @@ impl SuggestRecordId { } } -/// A suggestion to ingest from a downloaded Remote Settings attachment. -#[derive(Clone, Debug, Deserialize)] -pub(crate) struct DownloadedSuggestion { - #[serde(rename = "id")] - pub block_id: i64, - pub advertiser: String, - pub iab_category: String, +impl<'a, T> From for SuggestRecordId<'a> +where + T: Into>, +{ + fn from(value: T) -> Self { + Self(value.into()) + } +} + +/// Fields that are common to all downloaded suggestions. +#[derive(Clone, Debug, Deserialize, Eq, PartialEq)] +pub(crate) struct DownloadedSuggestionCommonDetails { pub keywords: Vec, pub title: String, pub url: String, +} + +/// An AMP suggestion to ingest from an AMP-Wikipedia attachment. +#[derive(Clone, Debug, Deserialize, Eq, PartialEq)] +pub(crate) struct DownloadedAmpSuggestion { + #[serde(flatten)] + pub common_details: DownloadedSuggestionCommonDetails, + pub advertiser: String, + #[serde(rename = "id")] + pub block_id: i32, + pub iab_category: String, + pub click_url: String, + pub impression_url: String, #[serde(rename = "icon")] pub icon_id: String, - pub impression_url: Option, - pub click_url: Option, +} + +/// A Wikipedia suggestion to ingest from an AMP-Wikipedia attachment. +#[derive(Clone, Debug, Deserialize, Eq, PartialEq)] +pub(crate) struct DownloadedWikipediaSuggestion { + #[serde(flatten)] + pub common_details: DownloadedSuggestionCommonDetails, + #[serde(rename = "icon")] + pub icon_id: String, +} + +/// A suggestion to ingest from an AMP-Wikipedia attachment downloaded from +/// Remote Settings. +#[derive(Clone, Debug, Eq, PartialEq)] +pub(crate) enum DownloadedAmpWikipediaSuggestion { + Amp(DownloadedAmpSuggestion), + Wikipedia(DownloadedWikipediaSuggestion), +} + +impl DownloadedAmpWikipediaSuggestion { + /// Returns the details that are common to AMP and Wikipedia suggestions. + pub fn common_details(&self) -> &DownloadedSuggestionCommonDetails { + match self { + Self::Amp(DownloadedAmpSuggestion { common_details, .. }) => common_details, + Self::Wikipedia(DownloadedWikipediaSuggestion { common_details, .. }) => common_details, + } + } + + /// Returns the provider of this suggestion. + pub fn provider(&self) -> SuggestionProvider { + match self { + DownloadedAmpWikipediaSuggestion::Amp(_) => SuggestionProvider::Amp, + DownloadedAmpWikipediaSuggestion::Wikipedia(_) => SuggestionProvider::Wikipedia, + } + } +} + +impl<'de> Deserialize<'de> for DownloadedAmpWikipediaSuggestion { + fn deserialize( + deserializer: D, + ) -> std::result::Result + where + D: Deserializer<'de>, + { + // AMP and Wikipedia suggestions use the same schema. To separate them, + // we use a "maybe tagged" outer enum with tagged and untagged variants, + // and a "tagged" inner enum. + // + // Wikipedia suggestions will deserialize successfully into the tagged + // variant. AMP suggestions will try the tagged variant, fail, and fall + // back to the untagged variant. + // + // This approach works around serde-rs/serde#912. + + #[derive(Deserialize)] + #[serde(untagged)] + enum MaybeTagged { + Tagged(Tagged), + Untagged(DownloadedAmpSuggestion), + } + + #[derive(Deserialize)] + #[serde(tag = "advertiser")] + enum Tagged { + #[serde(rename = "Wikipedia")] + Wikipedia(DownloadedWikipediaSuggestion), + } + + Ok(match MaybeTagged::deserialize(deserializer)? { + MaybeTagged::Tagged(Tagged::Wikipedia(wikipedia)) => Self::Wikipedia(wikipedia), + MaybeTagged::Untagged(amp) => Self::Amp(amp), + }) + } } diff --git a/third_party/rust/suggest/src/schema.rs b/third_party/rust/suggest/src/schema.rs index ec92dae08e58..8b83b4dead14 100644 --- a/third_party/rust/suggest/src/schema.rs +++ b/third_party/rust/suggest/src/schema.rs @@ -6,7 +6,7 @@ use rusqlite::{Connection, Transaction}; use sql_support::open_database::{self, ConnectionInitializer}; -pub const VERSION: u32 = 1; +pub const VERSION: u32 = 3; pub const SQL: &str = " CREATE TABLE meta( @@ -26,14 +26,26 @@ pub const SQL: &str = " CREATE TABLE suggestions( id INTEGER PRIMARY KEY, record_id TEXT NOT NULL, - block_id INTEGER NOT NULL, - advertiser TEXT NOT NULL, - iab_category TEXT NOT NULL, + provider INTEGER NOT NULL, title TEXT NOT NULL, - url TEXT NOT NULL, + url TEXT 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, - impression_url TEXT, - click_url TEXT + 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 INDEX suggestions_record_id ON suggestions(record_id); @@ -71,6 +83,14 @@ impl ConnectionInitializer for SuggestConnectionInitializer { } fn upgrade_from(&self, _db: &Transaction<'_>, version: u32) -> open_database::Result<()> { - Err(open_database::Error::IncompatibleVersion(version)) + match version { + 1..=2 => { + // These schema versions were used during development, and never + // shipped in any applications. Treat these databases as + // corrupt, so that they'll be replaced. + Err(open_database::Error::Corrupt) + } + _ => Err(open_database::Error::IncompatibleVersion(version)), + } } } diff --git a/third_party/rust/suggest/src/store.rs b/third_party/rust/suggest/src/store.rs index bb187c48ad61..e369610af8fb 100644 --- a/third_party/rust/suggest/src/store.rs +++ b/third_party/rust/suggest/src/store.rs @@ -11,8 +11,8 @@ use remote_settings::{self, GetItemsOptions, RemoteSettingsConfig, SortOrder}; use crate::{ db::{ConnectionType, SuggestDb, LAST_INGEST_META_KEY}, rs::{ - SuggestRecord, SuggestRemoteSettingsClient, TypedSuggestRecord, REMOTE_SETTINGS_COLLECTION, - SUGGESTIONS_PER_ATTACHMENT, + SuggestAttachment, SuggestRecord, SuggestRecordId, SuggestRemoteSettingsClient, + REMOTE_SETTINGS_COLLECTION, SUGGESTIONS_PER_ATTACHMENT, }, Result, SuggestApiResult, Suggestion, SuggestionQuery, }; @@ -141,8 +141,8 @@ impl SuggestStoreInner { Ok(suggestions .into_iter() .filter(|suggestion| { - (suggestion.is_sponsored && query.include_sponsored) - || (!suggestion.is_sponsored && query.include_non_sponsored) + (suggestion.is_sponsored() && query.include_sponsored) + || (!suggestion.is_sponsored() && query.include_non_sponsored) }) .collect()) } @@ -186,18 +186,41 @@ where let records = self .settings_client .get_records_with_options(&options)? - .data; + .records; for record in &records { - match record { - SuggestRecord::Typed(TypedSuggestRecord::Data { - id: record_id, - last_modified, - attachment, - }) => { - let suggestions = self - .settings_client - .get_data_attachment(&attachment.location)? - .0; + let record_id = SuggestRecordId::from(&record.id); + if record.deleted { + // If the entire record was deleted, drop all its suggestions + // and advance the last ingest time. + writer.write(|dao| { + match record_id.as_icon_id() { + Some(icon_id) => dao.drop_icon(icon_id)?, + None => dao.drop_suggestions(&record_id)?, + }; + dao.put_meta(LAST_INGEST_META_KEY, record.last_modified)?; + Ok(()) + })?; + continue; + } + let Ok(fields) = serde_json::from_value(serde_json::Value::Object(record.fields.clone())) else { + // We don't recognize this record's type, so we don't know how + // to ingest its suggestions. Skip to the next record. + writer.write(|dao| dao.put_meta(LAST_INGEST_META_KEY, record.last_modified))?; + continue; + }; + match fields { + SuggestRecord::AmpWikipedia => { + let Some(attachment) = record.attachment.as_ref() else { + // An AMP-Wikipedia record should always have an + // attachment with suggestions. If it doesn't, it's + // malformed, so skip to the next record. + writer.write(|dao| dao.put_meta(LAST_INGEST_META_KEY, record.last_modified))?; + continue; + }; + + let attachment: SuggestAttachment<_> = serde_json::from_slice( + &self.settings_client.get_attachment(&attachment.location)?, + )?; writer.write(|dao| { // Drop any suggestions that we previously ingested from @@ -205,52 +228,34 @@ where // stable identifier, and determining which suggestions in // the attachment actually changed is more complicated than // dropping and re-ingesting all of them. - dao.drop_suggestions(record_id)?; + dao.drop_suggestions(&record_id)?; - // Ingest (or re-ingest) all suggestions in the attachment. - dao.insert_suggestions(record_id, &suggestions)?; + // Ingest (or re-ingest) all suggestions in the + // attachment. + dao.insert_amp_wikipedia_suggestions(&record_id, attachment.suggestions())?; // Advance the last fetch time, so that we can resume // fetching after this record if we're interrupted. - dao.put_meta(LAST_INGEST_META_KEY, last_modified)?; + dao.put_meta(LAST_INGEST_META_KEY, record.last_modified)?; Ok(()) })?; } - SuggestRecord::Untyped { - id: record_id, - last_modified, - deleted, - } if *deleted => { - // If the entire record was deleted, drop all its - // suggestions and advance the last fetch time. - writer.write(|dao| { - match record_id.as_icon_id() { - Some(icon_id) => dao.drop_icon(icon_id)?, - None => dao.drop_suggestions(record_id)?, - }; - dao.put_meta(LAST_INGEST_META_KEY, last_modified)?; - Ok(()) - })?; - } - SuggestRecord::Typed(TypedSuggestRecord::Icon { - id: record_id, - last_modified, - attachment, - }) => { - let Some(icon_id) = record_id.as_icon_id() else { - continue + SuggestRecord::Icon => { + let (Some(icon_id), Some(attachment)) = (record_id.as_icon_id(), record.attachment.as_ref()) else { + // An icon record should have an icon ID and an + // attachment. Icons that don't have these are + // malformed, so skip to the next record. + writer.write(|dao| dao.put_meta(LAST_INGEST_META_KEY, record.last_modified))?; + continue; }; - let data = self - .settings_client - .get_icon_attachment(&attachment.location)?; + let data = self.settings_client.get_attachment(&attachment.location)?; writer.write(|dao| { - dao.insert_icon(icon_id, &data)?; - dao.put_meta(LAST_INGEST_META_KEY, last_modified)?; + dao.put_icon(icon_id, &data)?; + dao.put_meta(LAST_INGEST_META_KEY, record.last_modified)?; Ok(()) })?; } - _ => continue, } } @@ -285,18 +290,36 @@ mod tests { use anyhow::{anyhow, Context}; use expect_test::expect; use parking_lot::Once; + use rc_crypto::rand; + use remote_settings::{RemoteSettingsRecord, RemoteSettingsResponse}; use serde_json::json; use sql_support::ConnExt; - use crate::rs::{DownloadedSuggestDataAttachment, SuggestRemoteSettingsRecords}; + /// Creates a unique in-memory Suggest store. + fn unique_test_store(settings_client: S) -> SuggestStoreInner + where + S: SuggestRemoteSettingsClient, + { + let mut unique_suffix = [0u8; 8]; + rand::fill(&mut unique_suffix).expect("Failed to generate unique suffix for test store"); + // A store opens separate connections to the same database for reading + // and writing, so we must give our in-memory database a name, and open + // it in shared-cache mode so that both connections can access it. + SuggestStoreInner::new( + format!( + "file:test_store_{}?mode=memory&cache=shared", + hex::encode(unique_suffix), + ), + settings_client, + ) + } /// A snapshot containing fake Remote Settings records and attachments for /// the store to ingest. We use snapshots to test the store's behavior in a /// data-driven way. struct Snapshot { - records: SuggestRemoteSettingsRecords, - data: HashMap<&'static str, DownloadedSuggestDataAttachment>, - icons: HashMap<&'static str, Vec>, + records: Vec, + attachments: HashMap<&'static str, Vec>, } impl Snapshot { @@ -306,13 +329,12 @@ mod tests { /// You can use the [`serde_json::json!`] macro to construct the JSON /// value, then pass it to this function. It's easier to use the /// `Snapshot::with_records(json!(...))` idiom than to construct the - /// nested `SuggestRemoteSettingsRecords` structure by hand. + /// records by hand. fn with_records(value: serde_json::Value) -> anyhow::Result { Ok(Self { records: serde_json::from_value(value) .context("Couldn't create snapshot with Remote Settings records")?, - data: HashMap::new(), - icons: HashMap::new(), + attachments: HashMap::new(), }) } @@ -322,17 +344,16 @@ mod tests { location: &'static str, value: serde_json::Value, ) -> anyhow::Result { - self.data.insert( + self.attachments.insert( location, - serde_json::from_value(value) - .context("Couldn't add data attachment to snapshot")?, + serde_json::to_vec(&value).context("Couldn't add data attachment to snapshot")?, ); Ok(self) } /// Adds an icon attachment to the snapshot. fn with_icon(mut self, location: &'static str, bytes: Vec) -> Self { - self.icons.insert(location, bytes); + self.attachments.insert(location, bytes); self } } @@ -377,32 +398,27 @@ mod tests { fn get_records_with_options( &self, options: &GetItemsOptions, - ) -> Result { + ) -> Result { *self.last_get_records_options.borrow_mut() = Some(options.clone()); - Ok(self.snapshot.borrow().records.clone()) + let records = self.snapshot.borrow().records.clone(); + let last_modified = records + .iter() + .map(|record| record.last_modified) + .max() + .unwrap_or(0); + Ok(RemoteSettingsResponse { + records, + last_modified, + }) } - fn get_data_attachment(&self, location: &str) -> Result { + fn get_attachment(&self, location: &str) -> Result> { Ok(self .snapshot .borrow() - .data + .attachments .get(location) - .unwrap_or_else(|| { - unreachable!("Unexpected request for data attachment `{}`", location) - }) - .clone()) - } - - fn get_icon_attachment(&self, location: &str) -> Result> { - Ok(self - .snapshot - .borrow() - .icons - .get(location) - .unwrap_or_else(|| { - unreachable!("Unexpected request for icon attachment `{}`", location) - }) + .unwrap_or_else(|| unreachable!("Unexpected request for attachment `{}`", location)) .clone()) } } @@ -429,20 +445,18 @@ mod tests { fn ingest_suggestions() -> anyhow::Result<()> { before_each(); - let snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "1234", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }], - }))? + let snapshot = Snapshot::with_records(json!([{ + "id": "1234", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!([{ @@ -453,19 +467,12 @@ mod tests { "title": "Los Pollos Hermanos - Albuquerque", "url": "https://www.lph-nm.biz", "icon": "5678", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url", }]), )?; - // We use SQLite's URI filename syntax to open a named in-memory - // database in shared-cache mode, so that it can be accessed by the - // store's reader and writer. - // - // The database name should be unique for each test, to avoid - // cross-contamination. - let store = SuggestStoreInner::new( - "file:ingest_suggestions?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); store.ingest(SuggestIngestionConstraints::default())?; @@ -473,17 +480,16 @@ mod tests { assert_eq!(dao.get_meta::(LAST_INGEST_META_KEY)?, Some(15)); expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Los Pollos Hermanos", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "los", + Amp { title: "Los Pollos Hermanos - Albuquerque", url: "https://www.lph-nm.biz", icon: None, - impression_url: None, - click_url: None, + full_keyword: "los", + block_id: 0, + advertiser: "Los Pollos Hermanos", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] @@ -500,31 +506,29 @@ mod tests { fn ingest_icons() -> anyhow::Result<()> { before_each(); - let snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }, { - "id": "icon-2", - "type": "icon", - "last_modified": 20, - "attachment": { - "filename": "icon-2.png", - "mimetype": "image/png", - "location": "icon-2.png", - "hash": "", - "size": 0, - }, - }], - }))? + let snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-2", + "type": "icon", + "last_modified": 20, + "attachment": { + "filename": "icon-2.png", + "mimetype": "image/png", + "location": "icon-2.png", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!([{ @@ -535,6 +539,8 @@ mod tests { "title": "Lasagna Come Out Tomorrow", "url": "https://www.lasagna.restaurant", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }, { "id": 0, "advertiser": "Good Place Eats", @@ -543,26 +549,20 @@ mod tests { "title": "Penne for Your Thoughts", "url": "https://penne.biz", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }]), )? .with_icon("icon-2.png", "i-am-an-icon".as_bytes().into()); - let store = SuggestStoreInner::new( - "file:ingest_icons?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); store.ingest(SuggestIngestionConstraints::default())?; store.dbs()?.reader.read(|dao| { expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "lasagna", + Amp { title: "Lasagna Come Out Tomorrow", url: "https://www.lasagna.restaurant", icon: Some( @@ -581,20 +581,19 @@ mod tests { 110, ], ), - impression_url: None, - click_url: None, + full_keyword: "lasagna", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] .assert_debug_eq(&dao.fetch_by_keyword("la")?); expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "penne", + Amp { title: "Penne for Your Thoughts", url: "https://penne.biz", icon: Some( @@ -613,8 +612,12 @@ mod tests { 110, ], ), - impression_url: None, - click_url: None, + full_keyword: "penne", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] @@ -632,20 +635,18 @@ mod tests { fn ingest_one_suggestion_in_data_attachment() -> anyhow::Result<()> { before_each(); - let snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }], - }))? + let snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!({ @@ -656,30 +657,28 @@ mod tests { "title": "Lasagna Come Out Tomorrow", "url": "https://www.lasagna.restaurant", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }), )?; - let store = SuggestStoreInner::new( - "file:ingest_one_suggestion_in_data_attachment?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); store.ingest(SuggestIngestionConstraints::default())?; store.dbs()?.reader.read(|dao| { expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "lasagna", + Amp { title: "Lasagna Come Out Tomorrow", url: "https://www.lasagna.restaurant", icon: None, - impression_url: None, - click_url: None, + full_keyword: "lasagna", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] @@ -693,24 +692,22 @@ mod tests { /// Tests re-ingesting suggestions from an updated attachment. #[test] - fn reingest() -> anyhow::Result<()> { + fn reingest_suggestions() -> anyhow::Result<()> { before_each(); // Ingest suggestions from the initial snapshot. - let initial_snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }], - }))? + let initial_snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!([{ @@ -721,6 +718,8 @@ mod tests { "title": "Lasagna Come Out Tomorrow", "url": "https://www.lasagna.restaurant", "icon": "1", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }, { "id": 0, "advertiser": "Los Pollos Hermanos", @@ -729,13 +728,12 @@ mod tests { "title": "Los Pollos Hermanos - Albuquerque", "url": "https://www.lph-nm.biz", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }]), )?; - let store = SuggestStoreInner::new( - "file:reingest?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(initial_snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(initial_snapshot)); store.ingest(SuggestIngestionConstraints::default())?; @@ -743,17 +741,16 @@ mod tests { assert_eq!(dao.get_meta(LAST_INGEST_META_KEY)?, Some(15u64)); expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "lasagna", + Amp { title: "Lasagna Come Out Tomorrow", url: "https://www.lasagna.restaurant", icon: None, - impression_url: None, - click_url: None, + full_keyword: "lasagna", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] @@ -763,20 +760,18 @@ mod tests { // Update the snapshot with new suggestions: drop Lasagna, update Los // Pollos, and add Penne. - *store.settings_client.snapshot.borrow_mut() = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 30, - "attachment": { - "filename": "data-1-1.json", - "mimetype": "application/json", - "location": "data-1-1.json", - "hash": "", - "size": 0, - }, - }], - }))? + *store.settings_client.snapshot.borrow_mut() = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 30, + "attachment": { + "filename": "data-1-1.json", + "mimetype": "application/json", + "location": "data-1-1.json", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1-1.json", json!([{ @@ -787,6 +782,8 @@ mod tests { "title": "Los Pollos Hermanos - Now Serving at 14 Locations!", "url": "https://www.lph-nm.biz", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }, { "id": 0, "advertiser": "Good Place Eats", @@ -795,6 +792,8 @@ mod tests { "title": "Penne for Your Thoughts", "url": "https://penne.biz", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }]), )?; @@ -805,34 +804,32 @@ mod tests { assert!(dao.fetch_by_keyword("la")?.is_empty()); expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Los Pollos Hermanos", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "los pollos", + Amp { title: "Los Pollos Hermanos - Now Serving at 14 Locations!", url: "https://www.lph-nm.biz", icon: None, - impression_url: None, - click_url: None, + full_keyword: "los pollos", + block_id: 0, + advertiser: "Los Pollos Hermanos", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] .assert_debug_eq(&dao.fetch_by_keyword("los ")?); expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "penne", + Amp { title: "Penne for Your Thoughts", url: "https://penne.biz", icon: None, - impression_url: None, - click_url: None, + full_keyword: "penne", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]] @@ -843,6 +840,194 @@ mod tests { Ok(()) } + /// Tests re-ingesting icons from an updated attachment. + #[test] + fn reingest_icons() -> anyhow::Result<()> { + before_each(); + + // Ingest suggestions and icons from the initial snapshot. + let initial_snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-2", + "type": "icon", + "last_modified": 20, + "attachment": { + "filename": "icon-2.png", + "mimetype": "image/png", + "location": "icon-2.png", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-3", + "type": "icon", + "last_modified": 25, + "attachment": { + "filename": "icon-3.png", + "mimetype": "image/png", + "location": "icon-3.png", + "hash": "", + "size": 0, + }, + }]))? + .with_data( + "data-1.json", + json!([{ + "id": 0, + "advertiser": "Good Place Eats", + "iab_category": "8 - Food & Drink", + "keywords": ["la", "las", "lasa", "lasagna", "lasagna come out tomorrow"], + "title": "Lasagna Come Out Tomorrow", + "url": "https://www.lasagna.restaurant", + "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" + }, { + "id": 0, + "advertiser": "Los Pollos Hermanos", + "iab_category": "8 - Food & Drink", + "keywords": ["lo", "los", "los pollos", "los pollos hermanos"], + "title": "Los Pollos Hermanos - Albuquerque", + "url": "https://www.lph-nm.biz", + "icon": "3", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" + }]), + )? + .with_icon("icon-2.png", "lasagna-icon".as_bytes().into()) + .with_icon("icon-3.png", "pollos-icon".as_bytes().into()); + + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(initial_snapshot)); + + store.ingest(SuggestIngestionConstraints::default())?; + + store.dbs()?.reader.read(|dao| { + assert_eq!(dao.get_meta(LAST_INGEST_META_KEY)?, Some(25u64)); + assert_eq!( + dao.conn + .query_one::("SELECT count(*) FROM suggestions")?, + 2 + ); + assert_eq!(dao.conn.query_one::("SELECT count(*) FROM icons")?, 2); + Ok(()) + })?; + + // Update the snapshot with new icons. + *store.settings_client.snapshot.borrow_mut() = Snapshot::with_records(json!([{ + "id": "icon-2", + "type": "icon", + "last_modified": 30, + "attachment": { + "filename": "icon-2.png", + "mimetype": "image/png", + "location": "icon-2.png", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-3", + "type": "icon", + "last_modified": 35, + "attachment": { + "filename": "icon-3.png", + "mimetype": "image/png", + "location": "icon-3.png", + "hash": "", + "size": 0, + } + }]))? + .with_icon("icon-2.png", "new-lasagna-icon".as_bytes().into()) + .with_icon("icon-3.png", "new-pollos-icon".as_bytes().into()); + + store.ingest(SuggestIngestionConstraints::default())?; + + store.dbs()?.reader.read(|dao| { + assert_eq!(dao.get_meta(LAST_INGEST_META_KEY)?, Some(35u64)); + expect![[r#" + [ + Amp { + title: "Lasagna Come Out Tomorrow", + url: "https://www.lasagna.restaurant", + icon: Some( + [ + 110, + 101, + 119, + 45, + 108, + 97, + 115, + 97, + 103, + 110, + 97, + 45, + 105, + 99, + 111, + 110, + ], + ), + full_keyword: "lasagna", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", + }, + ] + "#]] + .assert_debug_eq(&dao.fetch_by_keyword("la")?); + expect![[r#" + [ + Amp { + title: "Los Pollos Hermanos - Albuquerque", + url: "https://www.lph-nm.biz", + icon: Some( + [ + 110, + 101, + 119, + 45, + 112, + 111, + 108, + 108, + 111, + 115, + 45, + 105, + 99, + 111, + 110, + ], + ), + full_keyword: "los", + block_id: 0, + advertiser: "Los Pollos Hermanos", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", + }, + ] + "#]] + .assert_debug_eq(&dao.fetch_by_keyword("lo")?); + Ok(()) + })?; + + Ok(()) + } + /// Tests ingesting tombstones for previously-ingested suggestions and /// icons. #[test] @@ -850,31 +1035,29 @@ mod tests { before_each(); // Ingest suggestions and icons from the initial snapshot. - let initial_snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }, { - "id": "icon-2", - "type": "icon", - "last_modified": 20, - "attachment": { - "filename": "icon-2.png", - "mimetype": "image/png", - "location": "icon-2.png", - "hash": "", - "size": 0, - }, - }], - }))? + let initial_snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-2", + "type": "icon", + "last_modified": 20, + "attachment": { + "filename": "icon-2.png", + "mimetype": "image/png", + "location": "icon-2.png", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!([{ @@ -885,14 +1068,13 @@ mod tests { "title": "Lasagna Come Out Tomorrow", "url": "https://www.lasagna.restaurant", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url" }]), )? .with_icon("icon-2.png", "i-am-an-icon".as_bytes().into()); - let store = SuggestStoreInner::new( - "file:ingest_tombstones?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(initial_snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(initial_snapshot)); store.ingest(SuggestIngestionConstraints::default())?; @@ -910,17 +1092,15 @@ mod tests { // Replace the records with tombstones. Ingesting these should remove // all their suggestions and icons. - *store.settings_client.snapshot.borrow_mut() = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "last_modified": 25, - "deleted": true, - }, { - "id": "icon-2", - "last_modified": 30, - "deleted": true, - }], - }))?; + *store.settings_client.snapshot.borrow_mut() = Snapshot::with_records(json!([{ + "id": "data-1", + "last_modified": 25, + "deleted": true, + }, { + "id": "icon-2", + "last_modified": 30, + "deleted": true, + }]))?; store.ingest(SuggestIngestionConstraints::default())?; @@ -944,14 +1124,9 @@ mod tests { fn ingest_with_constraints() -> anyhow::Result<()> { before_each(); - let snapshot = Snapshot::with_records(json!({ - "data": [], - }))?; + let snapshot = Snapshot::with_records(json!([]))?; - let store = SuggestStoreInner::new( - "file:ingest_with_constraints?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); store.ingest(SuggestIngestionConstraints::default())?; assert_eq!( @@ -995,20 +1170,18 @@ mod tests { fn clear() -> anyhow::Result<()> { before_each(); - let snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }], - }))? + let snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!([{ @@ -1019,13 +1192,12 @@ mod tests { "title": "Los Pollos Hermanos - Albuquerque", "url": "https://www.lph-nm.biz", "icon": "2", + "impression_url": "https://example.com", + "click_url": "https://example.com", }]), )?; - let store = SuggestStoreInner::new( - "file:clear?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); store.ingest(SuggestIngestionConstraints::default())?; @@ -1069,42 +1241,40 @@ mod tests { fn query() -> anyhow::Result<()> { before_each(); - let snapshot = Snapshot::with_records(json!({ - "data": [{ - "id": "data-1", - "type": "data", - "last_modified": 15, - "attachment": { - "filename": "data-1.json", - "mimetype": "application/json", - "location": "data-1.json", - "hash": "", - "size": 0, - }, - }, { - "id": "icon-2", - "type": "icon", - "last_modified": 20, - "attachment": { - "filename": "icon-2.png", - "mimetype": "image/png", - "location": "icon-2.png", - "hash": "", - "size": 0, - }, - }, { - "id": "icon-3", - "type": "icon", - "last_modified": 25, - "attachment": { - "filename": "icon-3.png", - "mimetype": "image/png", - "location": "icon-3.png", - "hash": "", - "size": 0, - }, - }], - }))? + let snapshot = Snapshot::with_records(json!([{ + "id": "data-1", + "type": "data", + "last_modified": 15, + "attachment": { + "filename": "data-1.json", + "mimetype": "application/json", + "location": "data-1.json", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-2", + "type": "icon", + "last_modified": 20, + "attachment": { + "filename": "icon-2.png", + "mimetype": "image/png", + "location": "icon-2.png", + "hash": "", + "size": 0, + }, + }, { + "id": "icon-3", + "type": "icon", + "last_modified": 25, + "attachment": { + "filename": "icon-3.png", + "mimetype": "image/png", + "location": "icon-3.png", + "hash": "", + "size": 0, + }, + }]))? .with_data( "data-1.json", json!([{ @@ -1115,6 +1285,8 @@ mod tests { "title": "Lasagna Come Out Tomorrow", "url": "https://www.lasagna.restaurant", "icon": "2", + "impression_url": "https://example.com/impression_url", + "click_url": "https://example.com/click_url", }, { "id": 0, "advertiser": "Wikipedia", @@ -1122,16 +1294,13 @@ mod tests { "keywords": ["cal", "cali", "california"], "title": "California", "url": "https://wikipedia.org/California", - "icon": "3", + "icon": "3" }]), )? .with_icon("icon-2.png", "i-am-an-icon".as_bytes().into()) .with_icon("icon-3.png", "also-an-icon".as_bytes().into()); - let store = SuggestStoreInner::new( - "file:query?mode=memory&cache=shared", - SnapshotSettingsClient::with_snapshot(snapshot), - ); + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); store.ingest(SuggestIngestionConstraints::default())?; @@ -1156,12 +1325,7 @@ mod tests { }, expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "lasagna", + Amp { title: "Lasagna Come Out Tomorrow", url: "https://www.lasagna.restaurant", icon: Some( @@ -1180,8 +1344,12 @@ mod tests { 110, ], ), - impression_url: None, - click_url: None, + full_keyword: "lasagna", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]], @@ -1195,12 +1363,7 @@ mod tests { }, expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Good Place Eats", - iab_category: "8 - Food & Drink", - is_sponsored: true, - full_keyword: "lasagna", + Amp { title: "Lasagna Come Out Tomorrow", url: "https://www.lasagna.restaurant", icon: Some( @@ -1219,8 +1382,12 @@ mod tests { 110, ], ), - impression_url: None, - click_url: None, + full_keyword: "lasagna", + block_id: 0, + advertiser: "Good Place Eats", + iab_category: "8 - Food & Drink", + impression_url: "https://example.com/impression_url", + click_url: "https://example.com/click_url", }, ] "#]], @@ -1278,12 +1445,7 @@ mod tests { }, expect![[r#" [ - Suggestion { - block_id: 0, - advertiser: "Wikipedia", - iab_category: "5 - Education", - is_sponsored: false, - full_keyword: "california", + Wikipedia { title: "California", url: "https://wikipedia.org/California", icon: Some( @@ -1302,8 +1464,7 @@ mod tests { 110, ], ), - impression_url: None, - click_url: None, + full_keyword: "california", }, ] "#]], @@ -1330,4 +1491,86 @@ mod tests { Ok(()) } + + /// Tests ingesting malformed Remote Settings records that we understand, + /// but that are missing fields, or aren't in the format we expect. + #[test] + fn ingest_malformed() -> anyhow::Result<()> { + before_each(); + + let snapshot = Snapshot::with_records(json!([{ + // Data record without an attachment. + "id": "missing-data-attachment", + "type": "data", + "last_modified": 15, + }, { + // Icon record without an attachment. + "id": "missing-icon-attachment", + "type": "icon", + "last_modified": 30, + }, { + // Icon record with an ID that's not `icon-{id}`, so suggestions in + // the data attachment won't be able to reference it. + "id": "bad-icon-id", + "type": "icon", + "last_modified": 45, + "attachment": { + "filename": "icon-1.png", + "mimetype": "image/png", + "location": "icon-1.png", + "hash": "", + "size": 0, + }, + }]))? + .with_icon("icon-1.png", "i-am-an-icon".as_bytes().into()); + + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); + + store.ingest(SuggestIngestionConstraints::default())?; + + store.dbs()?.reader.read(|dao| { + assert_eq!(dao.get_meta::(LAST_INGEST_META_KEY)?, Some(45)); + assert_eq!( + dao.conn + .query_one::("SELECT count(*) FROM suggestions")?, + 0 + ); + assert_eq!(dao.conn.query_one::("SELECT count(*) FROM icons")?, 0); + + Ok(()) + })?; + + Ok(()) + } + + /// Tests unknown Remote Settings records, which we don't know how to ingest + /// at all. + #[test] + fn ingest_unknown() -> anyhow::Result<()> { + before_each(); + + let snapshot = Snapshot::with_records(json!([{ + "id": "fancy-new-suggestions-1", + "type": "fancy-new-suggestions", + "last_modified": 15, + }, { + "id": "clippy-2", + "type": "clippy", + "last_modified": 30, + }]))?; + + let store = unique_test_store(SnapshotSettingsClient::with_snapshot(snapshot)); + + store.ingest(SuggestIngestionConstraints::default())?; + + store.dbs()?.reader.read(|dao| { + // Unknown records should still advance the last ingest time, but + // we don't try to store or ingest any suggestions from them. + assert_eq!(dao.get_meta::(LAST_INGEST_META_KEY)?, Some(30)); + + Ok(()) + })?; + + Ok(()) + } } diff --git a/third_party/rust/suggest/src/suggest.udl b/third_party/rust/suggest/src/suggest.udl index a5f153c6dd61..8098c7167224 100644 --- a/third_party/rust/suggest/src/suggest.udl +++ b/third_party/rust/suggest/src/suggest.udl @@ -15,17 +15,31 @@ interface SuggestApiError { Other(string reason); }; -dictionary Suggestion { - i64 block_id; - string advertiser; - string iab_category; - boolean is_sponsored; - string full_keyword; - string title; - string url; - sequence? icon; - string? impression_url; - string? click_url; + +enum SuggestionProvider { + "Amp", + "Wikipedia", +}; + +[Enum] +interface Suggestion { + Amp( + string title, + string url, + sequence? icon, + string full_keyword, + i64 block_id, + string advertiser, + string iab_category, + string impression_url, + string click_url + ); + Wikipedia( + string title, + string url, + sequence? icon, + string full_keyword + ); }; dictionary SuggestionQuery { diff --git a/third_party/rust/suggest/src/suggestion.rs b/third_party/rust/suggest/src/suggestion.rs new file mode 100644 index 000000000000..b3eeb7488188 --- /dev/null +++ b/third_party/rust/suggest/src/suggestion.rs @@ -0,0 +1,33 @@ +/* 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/. + */ + +/// A suggestion from the database to show in the address bar. +#[derive(Clone, Debug, Eq, Hash, PartialEq)] +pub enum Suggestion { + Amp { + title: String, + url: String, + icon: Option>, + full_keyword: String, + block_id: i64, + advertiser: String, + iab_category: String, + impression_url: String, + click_url: String, + }, + Wikipedia { + title: String, + url: String, + icon: Option>, + full_keyword: String, + }, +} + +impl Suggestion { + /// Returns `true` if the suggestion is sponsored. + pub(crate) fn is_sponsored(&self) -> bool { + matches!(self, Self::Amp { .. }) + } +} diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs new file mode 100644 index 000000000000..140abd08975b --- /dev/null +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustRemoteSettings.sys.mjs @@ -0,0 +1,1204 @@ +// This file was autogenerated by the `uniffi-bindgen-gecko-js` crate. +// Trust me, you don't want to mess with it! + +import { UniFFITypeError } from "resource://gre/modules/UniFFI.sys.mjs"; + + + +// Objects intended to be used in the unit tests +export var UnitTestObjs = {}; + +// Write/Read data to/from an ArrayBuffer +class ArrayBufferDataStream { + constructor(arrayBuffer) { + this.dataView = new DataView(arrayBuffer); + this.pos = 0; + } + + readUint8() { + let rv = this.dataView.getUint8(this.pos); + this.pos += 1; + return rv; + } + + writeUint8(value) { + this.dataView.setUint8(this.pos, value); + this.pos += 1; + } + + readUint16() { + let rv = this.dataView.getUint16(this.pos); + this.pos += 2; + return rv; + } + + writeUint16(value) { + this.dataView.setUint16(this.pos, value); + this.pos += 2; + } + + readUint32() { + let rv = this.dataView.getUint32(this.pos); + this.pos += 4; + return rv; + } + + writeUint32(value) { + this.dataView.setUint32(this.pos, value); + this.pos += 4; + } + + readUint64() { + let rv = this.dataView.getBigUint64(this.pos); + this.pos += 8; + return Number(rv); + } + + writeUint64(value) { + this.dataView.setBigUint64(this.pos, BigInt(value)); + this.pos += 8; + } + + + readInt8() { + let rv = this.dataView.getInt8(this.pos); + this.pos += 1; + return rv; + } + + writeInt8(value) { + this.dataView.setInt8(this.pos, value); + this.pos += 1; + } + + readInt16() { + let rv = this.dataView.getInt16(this.pos); + this.pos += 2; + return rv; + } + + writeInt16(value) { + this.dataView.setInt16(this.pos, value); + this.pos += 2; + } + + readInt32() { + let rv = this.dataView.getInt32(this.pos); + this.pos += 4; + return rv; + } + + writeInt32(value) { + this.dataView.setInt32(this.pos, value); + this.pos += 4; + } + + readInt64() { + let rv = this.dataView.getBigInt64(this.pos); + this.pos += 8; + return Number(rv); + } + + writeInt64(value) { + this.dataView.setBigInt64(this.pos, BigInt(value)); + this.pos += 8; + } + + readFloat32() { + let rv = this.dataView.getFloat32(this.pos); + this.pos += 4; + return rv; + } + + writeFloat32(value) { + this.dataView.setFloat32(this.pos, value); + this.pos += 4; + } + + readFloat64() { + let rv = this.dataView.getFloat64(this.pos); + this.pos += 8; + return rv; + } + + writeFloat64(value) { + this.dataView.setFloat64(this.pos, value); + this.pos += 8; + } + + + writeString(value) { + const encoder = new TextEncoder(); + // Note: in order to efficiently write this data, we first write the + // string data, reserving 4 bytes for the size. + const dest = new Uint8Array(this.dataView.buffer, this.pos + 4); + const encodeResult = encoder.encodeInto(value, dest); + if (encodeResult.read != value.length) { + throw new UniFFIError( + "writeString: out of space when writing to ArrayBuffer. Did the computeSize() method returned the wrong result?" + ); + } + const size = encodeResult.written; + // Next, go back and write the size before the string data + this.dataView.setUint32(this.pos, size); + // Finally, advance our position past both the size and string data + this.pos += size + 4; + } + + readString() { + const decoder = new TextDecoder(); + const size = this.readUint32(); + const source = new Uint8Array(this.dataView.buffer, this.pos, size) + const value = decoder.decode(source); + this.pos += size; + return value; + } + + // Reads a RemoteSettings pointer from the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + readPointerRemoteSettings() { + const pointerId = 3; // remote_settings:RemoteSettings + const res = UniFFIScaffolding.readPointer(pointerId, this.dataView.buffer, this.pos); + this.pos += 8; + return res; + } + + // Writes a RemoteSettings pointer into the data stream + // UniFFI Pointers are **always** 8 bytes long. That is enforced + // by the C++ and Rust Scaffolding code. + writePointerRemoteSettings(value) { + const pointerId = 3; // remote_settings:RemoteSettings + UniFFIScaffolding.writePointer(pointerId, value, this.dataView.buffer, this.pos); + this.pos += 8; + } + +} + +function handleRustResult(result, liftCallback, liftErrCallback) { + switch (result.code) { + case "success": + return liftCallback(result.data); + + case "error": + throw liftErrCallback(result.data); + + case "internal-error": + let message = result.internalErrorMessage; + if (message) { + throw new UniFFIInternalError(message); + } else { + throw new UniFFIInternalError("Unknown error"); + } + + default: + throw new UniFFIError(`Unexpected status code: ${result.code}`); + } +} + +class UniFFIError { + constructor(message) { + this.message = message; + } + + toString() { + return `UniFFIError: ${this.message}` + } +} + +class UniFFIInternalError extends UniFFIError {} + +// Base class for FFI converters +class FfiConverter { + // throw `UniFFITypeError` if a value to be converted has an invalid type + static checkType(value) { + if (value === undefined ) { + throw new UniFFITypeError(`undefined`); + } + if (value === null ) { + throw new UniFFITypeError(`null`); + } + } +} + +// Base class for FFI converters that lift/lower by reading/writing to an ArrayBuffer +class FfiConverterArrayBuffer extends FfiConverter { + static lift(buf) { + return this.read(new ArrayBufferDataStream(buf)); + } + + static lower(value) { + const buf = new ArrayBuffer(this.computeSize(value)); + const dataStream = new ArrayBufferDataStream(buf); + this.write(dataStream, value); + return buf; + } +} + +// Symbols that are used to ensure that Object constructors +// can only be used with a proper UniFFI pointer +const uniffiObjectPtr = Symbol("uniffiObjectPtr"); +const constructUniffiObject = Symbol("constructUniffiObject"); +UnitTestObjs.uniffiObjectPtr = uniffiObjectPtr; + +// Export the FFIConverter object to make external types work. +export class FfiConverterU64 extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (!Number.isSafeInteger(value)) { + throw new UniFFITypeError(`${value} exceeds the safe integer bounds`); + } + if (value < 0) { + throw new UniFFITypeError(`${value} exceeds the U64 bounds`); + } + } + static computeSize() { + return 8; + } + static lift(value) { + return value; + } + static lower(value) { + return value; + } + static write(dataStream, value) { + dataStream.writeUint64(value) + } + static read(dataStream) { + return dataStream.readUint64() + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterBool extends FfiConverter { + static computeSize() { + return 1; + } + static lift(value) { + return value == 1; + } + static lower(value) { + if (value) { + return 1; + } else { + return 0; + } + } + static write(dataStream, value) { + dataStream.writeUint8(this.lower(value)) + } + static read(dataStream) { + return this.lift(dataStream.readUint8()) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterString extends FfiConverter { + static checkType(value) { + super.checkType(value); + if (typeof value !== "string") { + throw new UniFFITypeError(`${value} is not a string`); + } + } + + static lift(buf) { + const decoder = new TextDecoder(); + const utf8Arr = new Uint8Array(buf); + return decoder.decode(utf8Arr); + } + static lower(value) { + const encoder = new TextEncoder(); + return encoder.encode(value).buffer; + } + + static write(dataStream, value) { + dataStream.writeString(value); + } + + static read(dataStream) { + return dataStream.readString(); + } + + static computeSize(value) { + const encoder = new TextEncoder(); + return 4 + encoder.encode(value).length + } +} + +export class RemoteSettings { + // Use `init` to instantiate this class. + // DO NOT USE THIS CONSTRUCTOR DIRECTLY + constructor(opts) { + if (!Object.prototype.hasOwnProperty.call(opts, constructUniffiObject)) { + throw new UniFFIError("Attempting to construct an object using the JavaScript constructor directly" + + "Please use a UDL defined constructor, or the init function for the primary constructor") + } + if (!opts[constructUniffiObject] instanceof UniFFIPointer) { + throw new UniFFIError("Attempting to create a UniFFI object with a pointer that is not an instance of UniFFIPointer") + } + this[uniffiObjectPtr] = opts[constructUniffiObject]; + } + /** + * A constructor for RemoteSettings. + * + * @returns { RemoteSettings } + */ + static init(remoteSettingsConfig) { + const liftResult = (result) => FfiConverterTypeRemoteSettings.lift(result); + const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); + const functionCall = () => { + try { + FfiConverterTypeRemoteSettingsConfig.checkType(remoteSettingsConfig) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("remoteSettingsConfig"); + } + throw e; + } + return UniFFIScaffolding.callSync( + 23, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new + FfiConverterTypeRemoteSettingsConfig.lower(remoteSettingsConfig), + ) + } + return handleRustResult(functionCall(), liftResult, liftError);} + + getRecords() { + const liftResult = (result) => FfiConverterTypeRemoteSettingsResponse.lift(result); + const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); + const functionCall = () => { + return UniFFIScaffolding.callAsync( + 24, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records + FfiConverterTypeRemoteSettings.lower(this), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + getRecordsSince(timestamp) { + const liftResult = (result) => FfiConverterTypeRemoteSettingsResponse.lift(result); + const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); + const functionCall = () => { + try { + FfiConverterU64.checkType(timestamp) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("timestamp"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 25, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since + FfiConverterTypeRemoteSettings.lower(this), + FfiConverterU64.lower(timestamp), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + + downloadAttachmentToPath(attachmentId,path) { + const liftResult = (result) => undefined; + const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data); + const functionCall = () => { + try { + FfiConverterString.checkType(attachmentId) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("attachmentId"); + } + throw e; + } + try { + FfiConverterString.checkType(path) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("path"); + } + throw e; + } + return UniFFIScaffolding.callAsync( + 26, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path + FfiConverterTypeRemoteSettings.lower(this), + FfiConverterString.lower(attachmentId), + FfiConverterString.lower(path), + ) + } + try { + return functionCall().then((result) => handleRustResult(result, liftResult, liftError)); + } catch (error) { + return Promise.reject(error) + } + } + +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeRemoteSettings extends FfiConverter { + static lift(value) { + const opts = {}; + opts[constructUniffiObject] = value; + return new RemoteSettings(opts); + } + + static lower(value) { + return value[uniffiObjectPtr]; + } + + static read(dataStream) { + return this.lift(dataStream.readPointerRemoteSettings()); + } + + static write(dataStream, value) { + dataStream.writePointerRemoteSettings(value[uniffiObjectPtr]); + } + + static computeSize(value) { + return 8; + } +} + +export class Attachment { + constructor(filename,mimetype,location,hash,size) { + try { + FfiConverterString.checkType(filename) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("filename"); + } + throw e; + } + try { + FfiConverterString.checkType(mimetype) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("mimetype"); + } + throw e; + } + try { + FfiConverterString.checkType(location) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("location"); + } + throw e; + } + try { + FfiConverterString.checkType(hash) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("hash"); + } + throw e; + } + try { + FfiConverterU64.checkType(size) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("size"); + } + throw e; + } + this.filename = filename; + this.mimetype = mimetype; + this.location = location; + this.hash = hash; + this.size = size; + } + equals(other) { + return ( + this.filename == other.filename && + this.mimetype == other.mimetype && + this.location == other.location && + this.hash == other.hash && + this.size == other.size + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeAttachment extends FfiConverterArrayBuffer { + static read(dataStream) { + return new Attachment( + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterU64.read(dataStream) + ); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.filename); + FfiConverterString.write(dataStream, value.mimetype); + FfiConverterString.write(dataStream, value.location); + FfiConverterString.write(dataStream, value.hash); + FfiConverterU64.write(dataStream, value.size); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.filename); + totalSize += FfiConverterString.computeSize(value.mimetype); + totalSize += FfiConverterString.computeSize(value.location); + totalSize += FfiConverterString.computeSize(value.hash); + totalSize += FfiConverterU64.computeSize(value.size); + return totalSize + } + + static checkType(value) { + super.checkType(value); + try { + FfiConverterString.checkType(value.filename); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".filename"); + } + throw e; + } + try { + FfiConverterString.checkType(value.mimetype); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".mimetype"); + } + throw e; + } + try { + FfiConverterString.checkType(value.location); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".location"); + } + throw e; + } + try { + FfiConverterString.checkType(value.hash); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".hash"); + } + throw e; + } + try { + FfiConverterU64.checkType(value.size); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".size"); + } + throw e; + } + } +} + +export class RemoteSettingsConfig { + constructor(serverUrl = null,bucketName = null,collectionName) { + try { + FfiConverterOptionalstring.checkType(serverUrl) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("serverUrl"); + } + throw e; + } + try { + FfiConverterOptionalstring.checkType(bucketName) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("bucketName"); + } + throw e; + } + try { + FfiConverterString.checkType(collectionName) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("collectionName"); + } + throw e; + } + this.serverUrl = serverUrl; + this.bucketName = bucketName; + this.collectionName = collectionName; + } + equals(other) { + return ( + this.serverUrl == other.serverUrl && + this.bucketName == other.bucketName && + this.collectionName == other.collectionName + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeRemoteSettingsConfig extends FfiConverterArrayBuffer { + static read(dataStream) { + return new RemoteSettingsConfig( + FfiConverterOptionalstring.read(dataStream), + FfiConverterOptionalstring.read(dataStream), + FfiConverterString.read(dataStream) + ); + } + static write(dataStream, value) { + FfiConverterOptionalstring.write(dataStream, value.serverUrl); + FfiConverterOptionalstring.write(dataStream, value.bucketName); + FfiConverterString.write(dataStream, value.collectionName); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterOptionalstring.computeSize(value.serverUrl); + totalSize += FfiConverterOptionalstring.computeSize(value.bucketName); + totalSize += FfiConverterString.computeSize(value.collectionName); + return totalSize + } + + static checkType(value) { + super.checkType(value); + try { + FfiConverterOptionalstring.checkType(value.serverUrl); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".serverUrl"); + } + throw e; + } + try { + FfiConverterOptionalstring.checkType(value.bucketName); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".bucketName"); + } + throw e; + } + try { + FfiConverterString.checkType(value.collectionName); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".collectionName"); + } + throw e; + } + } +} + +export class RemoteSettingsRecord { + constructor(id,lastModified,deleted,attachment,fields) { + try { + FfiConverterString.checkType(id) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("id"); + } + throw e; + } + try { + FfiConverterU64.checkType(lastModified) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("lastModified"); + } + throw e; + } + try { + FfiConverterBool.checkType(deleted) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("deleted"); + } + throw e; + } + try { + FfiConverterOptionalTypeAttachment.checkType(attachment) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("attachment"); + } + throw e; + } + try { + FfiConverterTypeRsJsonObject.checkType(fields) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("fields"); + } + throw e; + } + this.id = id; + this.lastModified = lastModified; + this.deleted = deleted; + this.attachment = attachment; + this.fields = fields; + } + equals(other) { + return ( + this.id == other.id && + this.lastModified == other.lastModified && + this.deleted == other.deleted && + this.attachment == other.attachment && + this.fields == other.fields + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeRemoteSettingsRecord extends FfiConverterArrayBuffer { + static read(dataStream) { + return new RemoteSettingsRecord( + FfiConverterString.read(dataStream), + FfiConverterU64.read(dataStream), + FfiConverterBool.read(dataStream), + FfiConverterOptionalTypeAttachment.read(dataStream), + FfiConverterTypeRsJsonObject.read(dataStream) + ); + } + static write(dataStream, value) { + FfiConverterString.write(dataStream, value.id); + FfiConverterU64.write(dataStream, value.lastModified); + FfiConverterBool.write(dataStream, value.deleted); + FfiConverterOptionalTypeAttachment.write(dataStream, value.attachment); + FfiConverterTypeRsJsonObject.write(dataStream, value.fields); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterString.computeSize(value.id); + totalSize += FfiConverterU64.computeSize(value.lastModified); + totalSize += FfiConverterBool.computeSize(value.deleted); + totalSize += FfiConverterOptionalTypeAttachment.computeSize(value.attachment); + totalSize += FfiConverterTypeRsJsonObject.computeSize(value.fields); + return totalSize + } + + static checkType(value) { + super.checkType(value); + try { + FfiConverterString.checkType(value.id); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".id"); + } + throw e; + } + try { + FfiConverterU64.checkType(value.lastModified); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".lastModified"); + } + throw e; + } + try { + FfiConverterBool.checkType(value.deleted); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".deleted"); + } + throw e; + } + try { + FfiConverterOptionalTypeAttachment.checkType(value.attachment); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".attachment"); + } + throw e; + } + try { + FfiConverterTypeRsJsonObject.checkType(value.fields); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".fields"); + } + throw e; + } + } +} + +export class RemoteSettingsResponse { + constructor(records,lastModified) { + try { + FfiConverterSequenceTypeRemoteSettingsRecord.checkType(records) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("records"); + } + throw e; + } + try { + FfiConverterU64.checkType(lastModified) + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart("lastModified"); + } + throw e; + } + this.records = records; + this.lastModified = lastModified; + } + equals(other) { + return ( + this.records == other.records && + this.lastModified == other.lastModified + ) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeRemoteSettingsResponse extends FfiConverterArrayBuffer { + static read(dataStream) { + return new RemoteSettingsResponse( + FfiConverterSequenceTypeRemoteSettingsRecord.read(dataStream), + FfiConverterU64.read(dataStream) + ); + } + static write(dataStream, value) { + FfiConverterSequenceTypeRemoteSettingsRecord.write(dataStream, value.records); + FfiConverterU64.write(dataStream, value.lastModified); + } + + static computeSize(value) { + let totalSize = 0; + totalSize += FfiConverterSequenceTypeRemoteSettingsRecord.computeSize(value.records); + totalSize += FfiConverterU64.computeSize(value.lastModified); + return totalSize + } + + static checkType(value) { + super.checkType(value); + try { + FfiConverterSequenceTypeRemoteSettingsRecord.checkType(value.records); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".records"); + } + throw e; + } + try { + FfiConverterU64.checkType(value.lastModified); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(".lastModified"); + } + throw e; + } + } +} + + + + +export class RemoteSettingsError extends Error {} + + +export class JsonError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `JsonError: ${super.toString()}` + } +} + +export class FileError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `FileError: ${super.toString()}` + } +} + +export class RequestError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `RequestError: ${super.toString()}` + } +} + +export class UrlParsingError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `UrlParsingError: ${super.toString()}` + } +} + +export class BackoffError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `BackoffError: ${super.toString()}` + } +} + +export class ResponseError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `ResponseError: ${super.toString()}` + } +} + +export class AttachmentsUnsupportedError extends RemoteSettingsError { + + constructor(message, ...params) { + super(...params); + this.message = message; + } + toString() { + return `AttachmentsUnsupportedError: ${super.toString()}` + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeRemoteSettingsError extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return new JsonError(FfiConverterString.read(dataStream)); + case 2: + return new FileError(FfiConverterString.read(dataStream)); + case 3: + return new RequestError(FfiConverterString.read(dataStream)); + case 4: + return new UrlParsingError(FfiConverterString.read(dataStream)); + case 5: + return new BackoffError(FfiConverterString.read(dataStream)); + case 6: + return new ResponseError(FfiConverterString.read(dataStream)); + case 7: + return new AttachmentsUnsupportedError(FfiConverterString.read(dataStream)); + default: + throw new Error("Unknown RemoteSettingsError variant"); + } + } + static computeSize(value) { + // Size of the Int indicating the variant + let totalSize = 4; + if (value instanceof JsonError) { + return totalSize; + } + if (value instanceof FileError) { + return totalSize; + } + if (value instanceof RequestError) { + return totalSize; + } + if (value instanceof UrlParsingError) { + return totalSize; + } + if (value instanceof BackoffError) { + return totalSize; + } + if (value instanceof ResponseError) { + return totalSize; + } + if (value instanceof AttachmentsUnsupportedError) { + return totalSize; + } + throw new Error("Unknown RemoteSettingsError variant"); + } + static write(dataStream, value) { + if (value instanceof JsonError) { + dataStream.writeInt32(1); + return; + } + if (value instanceof FileError) { + dataStream.writeInt32(2); + return; + } + if (value instanceof RequestError) { + dataStream.writeInt32(3); + return; + } + if (value instanceof UrlParsingError) { + dataStream.writeInt32(4); + return; + } + if (value instanceof BackoffError) { + dataStream.writeInt32(5); + return; + } + if (value instanceof ResponseError) { + dataStream.writeInt32(6); + return; + } + if (value instanceof AttachmentsUnsupportedError) { + dataStream.writeInt32(7); + return; + } + throw new Error("Unknown RemoteSettingsError variant"); + } + + static errorClass = RemoteSettingsError; +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalstring extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterString.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterString.read(dataStream) + default: + throw UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterString.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterString.computeSize(value) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterOptionalTypeAttachment extends FfiConverterArrayBuffer { + static checkType(value) { + if (value !== undefined && value !== null) { + FfiConverterTypeAttachment.checkType(value) + } + } + + static read(dataStream) { + const code = dataStream.readUint8(0); + switch (code) { + case 0: + return null + case 1: + return FfiConverterTypeAttachment.read(dataStream) + default: + throw UniFFIError(`Unexpected code: ${code}`); + } + } + + static write(dataStream, value) { + if (value === null || value === undefined) { + dataStream.writeUint8(0); + return; + } + dataStream.writeUint8(1); + FfiConverterTypeAttachment.write(dataStream, value) + } + + static computeSize(value) { + if (value === null || value === undefined) { + return 1; + } + return 1 + FfiConverterTypeAttachment.computeSize(value) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterSequenceTypeRemoteSettingsRecord extends FfiConverterArrayBuffer { + static read(dataStream) { + const len = dataStream.readInt32(); + const arr = []; + for (let i = 0; i < len; i++) { + arr.push(FfiConverterTypeRemoteSettingsRecord.read(dataStream)); + } + return arr; + } + + static write(dataStream, value) { + dataStream.writeInt32(value.length); + value.forEach((innerValue) => { + FfiConverterTypeRemoteSettingsRecord.write(dataStream, innerValue); + }) + } + + static computeSize(value) { + // The size of the length + let size = 4; + for (const innerValue of value) { + size += FfiConverterTypeRemoteSettingsRecord.computeSize(innerValue); + } + return size; + } + + static checkType(value) { + if (!Array.isArray(value)) { + throw new UniFFITypeError(`${value} is not an array`); + } + value.forEach((innerValue, idx) => { + try { + FfiConverterTypeRemoteSettingsRecord.checkType(innerValue); + } catch (e) { + if (e instanceof UniFFITypeError) { + e.addItemDescriptionPart(`[${idx}]`); + } + throw e; + } + }) + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeRsJsonObject extends FfiConverter { + static lift(buf) { + return FfiConverterString.lift(buf); + } + + static lower(buf) { + return FfiConverterString.lower(buf); + } + + static write(dataStream, value) { + FfiConverterString.write(dataStream, value); + } + + static read(buf) { + return FfiConverterString.read(buf); + } + + static computeSize(value) { + return FfiConverterString.computeSize(value); + } +} +// TODO: We should also allow JS to customize the type eventually. + + + + diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs index 44131669b8cc..194a4235d028 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/generated/RustSuggest.sys.mjs @@ -578,244 +578,6 @@ export class FfiConverterTypeSuggestIngestionConstraints extends FfiConverterArr } } -export class Suggestion { - constructor(blockId,advertiser,iabCategory,isSponsored,fullKeyword,title,url,icon,impressionUrl,clickUrl) { - try { - FfiConverterI64.checkType(blockId) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("blockId"); - } - throw e; - } - try { - FfiConverterString.checkType(advertiser) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("advertiser"); - } - throw e; - } - try { - FfiConverterString.checkType(iabCategory) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("iabCategory"); - } - throw e; - } - try { - FfiConverterBool.checkType(isSponsored) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("isSponsored"); - } - throw e; - } - try { - FfiConverterString.checkType(fullKeyword) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("fullKeyword"); - } - throw e; - } - try { - FfiConverterString.checkType(title) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("title"); - } - throw e; - } - try { - FfiConverterString.checkType(url) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("url"); - } - throw e; - } - try { - FfiConverterOptionalSequenceu8.checkType(icon) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("icon"); - } - throw e; - } - try { - FfiConverterOptionalstring.checkType(impressionUrl) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("impressionUrl"); - } - throw e; - } - try { - FfiConverterOptionalstring.checkType(clickUrl) - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart("clickUrl"); - } - throw e; - } - this.blockId = blockId; - this.advertiser = advertiser; - this.iabCategory = iabCategory; - this.isSponsored = isSponsored; - this.fullKeyword = fullKeyword; - this.title = title; - this.url = url; - this.icon = icon; - this.impressionUrl = impressionUrl; - this.clickUrl = clickUrl; - } - equals(other) { - return ( - this.blockId == other.blockId && - this.advertiser == other.advertiser && - this.iabCategory == other.iabCategory && - this.isSponsored == other.isSponsored && - this.fullKeyword == other.fullKeyword && - this.title == other.title && - this.url == other.url && - this.icon == other.icon && - this.impressionUrl == other.impressionUrl && - this.clickUrl == other.clickUrl - ) - } -} - -// Export the FFIConverter object to make external types work. -export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer { - static read(dataStream) { - return new Suggestion( - FfiConverterI64.read(dataStream), - FfiConverterString.read(dataStream), - FfiConverterString.read(dataStream), - FfiConverterBool.read(dataStream), - FfiConverterString.read(dataStream), - FfiConverterString.read(dataStream), - FfiConverterString.read(dataStream), - FfiConverterOptionalSequenceu8.read(dataStream), - FfiConverterOptionalstring.read(dataStream), - FfiConverterOptionalstring.read(dataStream) - ); - } - static write(dataStream, value) { - FfiConverterI64.write(dataStream, value.blockId); - FfiConverterString.write(dataStream, value.advertiser); - FfiConverterString.write(dataStream, value.iabCategory); - FfiConverterBool.write(dataStream, value.isSponsored); - FfiConverterString.write(dataStream, value.fullKeyword); - FfiConverterString.write(dataStream, value.title); - FfiConverterString.write(dataStream, value.url); - FfiConverterOptionalSequenceu8.write(dataStream, value.icon); - FfiConverterOptionalstring.write(dataStream, value.impressionUrl); - FfiConverterOptionalstring.write(dataStream, value.clickUrl); - } - - static computeSize(value) { - let totalSize = 0; - totalSize += FfiConverterI64.computeSize(value.blockId); - totalSize += FfiConverterString.computeSize(value.advertiser); - totalSize += FfiConverterString.computeSize(value.iabCategory); - totalSize += FfiConverterBool.computeSize(value.isSponsored); - totalSize += FfiConverterString.computeSize(value.fullKeyword); - totalSize += FfiConverterString.computeSize(value.title); - totalSize += FfiConverterString.computeSize(value.url); - totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon); - totalSize += FfiConverterOptionalstring.computeSize(value.impressionUrl); - totalSize += FfiConverterOptionalstring.computeSize(value.clickUrl); - return totalSize - } - - static checkType(value) { - super.checkType(value); - try { - FfiConverterI64.checkType(value.blockId); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".blockId"); - } - throw e; - } - try { - FfiConverterString.checkType(value.advertiser); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".advertiser"); - } - throw e; - } - try { - FfiConverterString.checkType(value.iabCategory); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".iabCategory"); - } - throw e; - } - try { - FfiConverterBool.checkType(value.isSponsored); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".isSponsored"); - } - throw e; - } - try { - FfiConverterString.checkType(value.fullKeyword); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".fullKeyword"); - } - throw e; - } - try { - FfiConverterString.checkType(value.title); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".title"); - } - throw e; - } - try { - FfiConverterString.checkType(value.url); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".url"); - } - throw e; - } - try { - FfiConverterOptionalSequenceu8.checkType(value.icon); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".icon"); - } - throw e; - } - try { - FfiConverterOptionalstring.checkType(value.impressionUrl); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".impressionUrl"); - } - throw e; - } - try { - FfiConverterOptionalstring.checkType(value.clickUrl); - } catch (e) { - if (e instanceof UniFFITypeError) { - e.addItemDescriptionPart(".clickUrl"); - } - throw e; - } - } -} - export class SuggestionQuery { constructor(keyword,includeSponsored,includeNonSponsored) { try { @@ -960,6 +722,177 @@ export class FfiConverterTypeSuggestApiError extends FfiConverterArrayBuffer { static errorClass = SuggestApiError; } + +export class Suggestion {} +Suggestion.Amp = class extends Suggestion{ + constructor( + title, + url, + icon, + fullKeyword, + blockId, + advertiser, + iabCategory, + impressionUrl, + clickUrl + ) { + super(); + this.title = title; + this.url = url; + this.icon = icon; + this.fullKeyword = fullKeyword; + this.blockId = blockId; + this.advertiser = advertiser; + this.iabCategory = iabCategory; + this.impressionUrl = impressionUrl; + this.clickUrl = clickUrl; + } +} +Suggestion.Wikipedia = class extends Suggestion{ + constructor( + title, + url, + icon, + fullKeyword + ) { + super(); + this.title = title; + this.url = url; + this.icon = icon; + this.fullKeyword = fullKeyword; + } +} + +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeSuggestion extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return new Suggestion.Amp( + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterOptionalSequenceu8.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterI64.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream) + ); + case 2: + return new Suggestion.Wikipedia( + FfiConverterString.read(dataStream), + FfiConverterString.read(dataStream), + FfiConverterOptionalSequenceu8.read(dataStream), + FfiConverterString.read(dataStream) + ); + default: + return new Error("Unknown Suggestion variant"); + } + } + + static write(dataStream, value) { + if (value instanceof Suggestion.Amp) { + dataStream.writeInt32(1); + FfiConverterString.write(dataStream, value.title); + FfiConverterString.write(dataStream, value.url); + FfiConverterOptionalSequenceu8.write(dataStream, value.icon); + FfiConverterString.write(dataStream, value.fullKeyword); + FfiConverterI64.write(dataStream, value.blockId); + FfiConverterString.write(dataStream, value.advertiser); + FfiConverterString.write(dataStream, value.iabCategory); + FfiConverterString.write(dataStream, value.impressionUrl); + FfiConverterString.write(dataStream, value.clickUrl); + return; + } + if (value instanceof Suggestion.Wikipedia) { + dataStream.writeInt32(2); + FfiConverterString.write(dataStream, value.title); + FfiConverterString.write(dataStream, value.url); + FfiConverterOptionalSequenceu8.write(dataStream, value.icon); + FfiConverterString.write(dataStream, value.fullKeyword); + return; + } + return new Error("Unknown Suggestion variant"); + } + + static computeSize(value) { + // Size of the Int indicating the variant + let totalSize = 4; + if (value instanceof Suggestion.Amp) { + totalSize += FfiConverterString.computeSize(value.title); + totalSize += FfiConverterString.computeSize(value.url); + totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon); + totalSize += FfiConverterString.computeSize(value.fullKeyword); + totalSize += FfiConverterI64.computeSize(value.blockId); + totalSize += FfiConverterString.computeSize(value.advertiser); + totalSize += FfiConverterString.computeSize(value.iabCategory); + totalSize += FfiConverterString.computeSize(value.impressionUrl); + totalSize += FfiConverterString.computeSize(value.clickUrl); + return totalSize; + } + if (value instanceof Suggestion.Wikipedia) { + totalSize += FfiConverterString.computeSize(value.title); + totalSize += FfiConverterString.computeSize(value.url); + totalSize += FfiConverterOptionalSequenceu8.computeSize(value.icon); + totalSize += FfiConverterString.computeSize(value.fullKeyword); + return totalSize; + } + return new Error("Unknown Suggestion variant"); + } + + static checkType(value) { + if (!(value instanceof Suggestion)) { + throw new UniFFITypeError(`${value} is not a subclass instance of Suggestion`); + } + } +} + + + +export const SuggestionProvider = { + AMP: 1, + WIKIPEDIA: 2, +}; + +Object.freeze(SuggestionProvider); +// Export the FFIConverter object to make external types work. +export class FfiConverterTypeSuggestionProvider extends FfiConverterArrayBuffer { + static read(dataStream) { + switch (dataStream.readInt32()) { + case 1: + return SuggestionProvider.AMP + case 2: + return SuggestionProvider.WIKIPEDIA + default: + return new Error("Unknown SuggestionProvider variant"); + } + } + + static write(dataStream, value) { + if (value === SuggestionProvider.AMP) { + dataStream.writeInt32(1); + return; + } + if (value === SuggestionProvider.WIKIPEDIA) { + dataStream.writeInt32(2); + return; + } + return new Error("Unknown SuggestionProvider variant"); + } + + static computeSize(value) { + return 4; + } + + static checkType(value) { + if (!Number.isInteger(value) || value < 1 || value > 2) { + throw new UniFFITypeError(`${value} is not a valid value for SuggestionProvider`); + } + } +} + + // Export the FFIConverter object to make external types work. export class FfiConverterOptionalu64 extends FfiConverterArrayBuffer { static checkType(value) { @@ -997,43 +930,6 @@ export class FfiConverterOptionalu64 extends FfiConverterArrayBuffer { } } -// Export the FFIConverter object to make external types work. -export class FfiConverterOptionalstring extends FfiConverterArrayBuffer { - static checkType(value) { - if (value !== undefined && value !== null) { - FfiConverterString.checkType(value) - } - } - - static read(dataStream) { - const code = dataStream.readUint8(0); - switch (code) { - case 0: - return null - case 1: - return FfiConverterString.read(dataStream) - default: - throw UniFFIError(`Unexpected code: ${code}`); - } - } - - static write(dataStream, value) { - if (value === null || value === undefined) { - dataStream.writeUint8(0); - return; - } - dataStream.writeUint8(1); - FfiConverterString.write(dataStream, value) - } - - static computeSize(value) { - if (value === null || value === undefined) { - return 1; - } - return 1 + FfiConverterString.computeSize(value) - } -} - // Export the FFIConverter object to make external types work. export class FfiConverterOptionalSequenceu8 extends FfiConverterArrayBuffer { static checkType(value) { diff --git a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build index 44cddbc40dbd..107745a4b873 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build +++ b/toolkit/components/uniffi-bindgen-gecko-js/components/moz.build @@ -5,6 +5,7 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. EXTRA_JS_MODULES += [ + "generated/RustRemoteSettings.sys.mjs", "generated/RustSuggest.sys.mjs", "generated/RustSync15.sys.mjs", "generated/RustTabs.sys.mjs", diff --git a/toolkit/components/uniffi-bindgen-gecko-js/config.toml b/toolkit/components/uniffi-bindgen-gecko-js/config.toml index 885c265f53a8..301b2dacd516 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/config.toml +++ b/toolkit/components/uniffi-bindgen-gecko-js/config.toml @@ -4,6 +4,12 @@ main = [ "log_even_numbers_main_thread", ] +[remote_settings.receiver_thread] +default = "worker" +main = [ + "RemoteSettings", +] + [suggest.receiver_thread] default = "worker" main = [ diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs index adfe58786a79..46f49a4254a2 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustArithmetic.sys.mjs @@ -377,7 +377,7 @@ export function add(a,b) { throw e; } return UniFFIScaffolding.callAsync( - 25, // arithmetic:uniffi_arithmetic_fn_func_add + 29, // arithmetic:uniffi_arithmetic_fn_func_add FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) @@ -411,7 +411,7 @@ export function sub(a,b) { throw e; } return UniFFIScaffolding.callAsync( - 26, // arithmetic:uniffi_arithmetic_fn_func_sub + 30, // arithmetic:uniffi_arithmetic_fn_func_sub FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) @@ -445,7 +445,7 @@ export function div(dividend,divisor) { throw e; } return UniFFIScaffolding.callAsync( - 27, // arithmetic:uniffi_arithmetic_fn_func_div + 31, // arithmetic:uniffi_arithmetic_fn_func_div FfiConverterU64.lower(dividend), FfiConverterU64.lower(divisor), ) @@ -479,7 +479,7 @@ export function equal(a,b) { throw e; } return UniFFIScaffolding.callAsync( - 28, // arithmetic:uniffi_arithmetic_fn_func_equal + 32, // arithmetic:uniffi_arithmetic_fn_func_equal FfiConverterU64.lower(a), FfiConverterU64.lower(b), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs index 8ba29897465b..1b69b4649906 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustCustomTypes.sys.mjs @@ -452,7 +452,7 @@ export function getCustomTypesDemo(demo) { throw e; } return UniFFIScaffolding.callAsync( - 112, // custom_types:uniffi_custom_types_fn_func_get_custom_types_demo + 116, // custom_types:uniffi_custom_types_fn_func_get_custom_types_demo FfiConverterOptionalTypeCustomTypesDemo.lower(demo), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs index 4f354e50bbc0..8be42f18a3fd 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustExternalTypes.sys.mjs @@ -344,7 +344,7 @@ export function gradient(value) { throw e; } return UniFFIScaffolding.callAsync( - 113, // external_types:uniffi_external_types_fn_func_gradient + 117, // external_types:uniffi_external_types_fn_func_gradient FfiConverterOptionalTypeLine.lower(value), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs index a5938fdbc1c9..4b5fcaeabcef 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustFixtureCallbacks.sys.mjs @@ -596,7 +596,7 @@ export function logEvenNumbers(logger,items) { throw e; } return UniFFIScaffolding.callAsync( - 110, // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers + 114, // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers FfiConverterCallbackInterfaceLogger.lower(logger), FfiConverterSequencei32.lower(items), ) @@ -630,7 +630,7 @@ export function logEvenNumbersMainThread(logger,items) { throw e; } return UniFFIScaffolding.callSync( - 111, // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread + 115, // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread FfiConverterCallbackInterfaceLogger.lower(logger), FfiConverterSequencei32.lower(items), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs index db58087c3eb7..71d3eb0a8e74 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustGeometry.sys.mjs @@ -468,7 +468,7 @@ export function gradient(ln) { throw e; } return UniFFIScaffolding.callAsync( - 23, // geometry:uniffi_geometry_fn_func_gradient + 27, // geometry:uniffi_geometry_fn_func_gradient FfiConverterTypeLine.lower(ln), ) } @@ -501,7 +501,7 @@ export function intersection(ln1,ln2) { throw e; } return UniFFIScaffolding.callAsync( - 24, // geometry:uniffi_geometry_fn_func_intersection + 28, // geometry:uniffi_geometry_fn_func_intersection FfiConverterTypeLine.lower(ln1), FfiConverterTypeLine.lower(ln2), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs index 515c9f28d878..486e5dc3c1d7 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustRondpoint.sys.mjs @@ -158,7 +158,7 @@ class ArrayBufferDataStream { // UniFFI Pointers are **always** 8 bytes long. That is enforced // by the C++ and Rust Scaffolding code. readPointerRetourneur() { - const pointerId = 3; // rondpoint:Retourneur + const pointerId = 4; // rondpoint:Retourneur 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. writePointerRetourneur(value) { - const pointerId = 3; // rondpoint:Retourneur + const pointerId = 4; // rondpoint:Retourneur 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. readPointerStringifier() { - const pointerId = 4; // rondpoint:Stringifier + const pointerId = 5; // rondpoint:Stringifier 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. writePointerStringifier(value) { - const pointerId = 4; // rondpoint:Stringifier + const pointerId = 5; // rondpoint:Stringifier 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. 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; @@ -208,7 +208,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; } @@ -620,7 +620,7 @@ export class Optionneur { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 58, // rondpoint:uniffi_rondpoint_fn_constructor_optionneur_new + 62, // rondpoint:uniffi_rondpoint_fn_constructor_optionneur_new ) } try { @@ -642,7 +642,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 59, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_boolean + 63, // rondpoint: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( - 60, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_string + 64, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_string FfiConverterTypeOptionneur.lower(this), FfiConverterString.lower(value), ) @@ -692,7 +692,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 61, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_sequence + 65, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_sequence FfiConverterTypeOptionneur.lower(this), FfiConverterSequencestring.lower(value), ) @@ -717,7 +717,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 62, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_null + 66, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_null FfiConverterTypeOptionneur.lower(this), FfiConverterOptionalstring.lower(value), ) @@ -742,7 +742,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 63, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_zero + 67, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_zero FfiConverterTypeOptionneur.lower(this), FfiConverterOptionali32.lower(value), ) @@ -767,7 +767,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 64, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec + 68, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU8.lower(value), ) @@ -792,7 +792,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 65, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec + 69, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI8.lower(value), ) @@ -817,7 +817,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 66, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec + 70, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU16.lower(value), ) @@ -842,7 +842,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 67, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec + 71, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI16.lower(value), ) @@ -867,7 +867,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 68, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec + 72, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -892,7 +892,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 69, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec + 73, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI32.lower(value), ) @@ -917,7 +917,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 70, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec + 74, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec FfiConverterTypeOptionneur.lower(this), FfiConverterU64.lower(value), ) @@ -942,7 +942,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 71, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec + 75, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec FfiConverterTypeOptionneur.lower(this), FfiConverterI64.lower(value), ) @@ -967,7 +967,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 72, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex + 76, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU8.lower(value), ) @@ -992,7 +992,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 73, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex + 77, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI8.lower(value), ) @@ -1017,7 +1017,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 74, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex + 78, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU16.lower(value), ) @@ -1042,7 +1042,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 75, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex + 79, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI16.lower(value), ) @@ -1067,7 +1067,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 76, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex + 80, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1092,7 +1092,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 77, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex + 81, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI32.lower(value), ) @@ -1117,7 +1117,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 78, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex + 82, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex FfiConverterTypeOptionneur.lower(this), FfiConverterU64.lower(value), ) @@ -1142,7 +1142,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 79, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex + 83, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex FfiConverterTypeOptionneur.lower(this), FfiConverterI64.lower(value), ) @@ -1167,7 +1167,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 80, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct + 84, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct FfiConverterTypeOptionneur.lower(this), FfiConverterU32.lower(value), ) @@ -1192,7 +1192,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 81, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f32 + 85, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f32 FfiConverterTypeOptionneur.lower(this), FfiConverterF32.lower(value), ) @@ -1217,7 +1217,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 82, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f64 + 86, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f64 FfiConverterTypeOptionneur.lower(this), FfiConverterF64.lower(value), ) @@ -1242,7 +1242,7 @@ export class Optionneur { throw e; } return UniFFIScaffolding.callAsync( - 83, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_enum + 87, // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_enum FfiConverterTypeOptionneur.lower(this), FfiConverterTypeEnumeration.lower(value), ) @@ -1305,7 +1305,7 @@ export class Retourneur { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 29, // rondpoint:uniffi_rondpoint_fn_constructor_retourneur_new + 33, // rondpoint:uniffi_rondpoint_fn_constructor_retourneur_new ) } try { @@ -1327,7 +1327,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 30, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i8 + 34, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i8 FfiConverterTypeRetourneur.lower(this), FfiConverterI8.lower(value), ) @@ -1352,7 +1352,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 31, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u8 + 35, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u8 FfiConverterTypeRetourneur.lower(this), FfiConverterU8.lower(value), ) @@ -1377,7 +1377,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 32, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i16 + 36, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i16 FfiConverterTypeRetourneur.lower(this), FfiConverterI16.lower(value), ) @@ -1402,7 +1402,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 33, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u16 + 37, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u16 FfiConverterTypeRetourneur.lower(this), FfiConverterU16.lower(value), ) @@ -1427,7 +1427,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 34, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i32 + 38, // rondpoint: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( - 35, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u32 + 39, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u32 FfiConverterTypeRetourneur.lower(this), FfiConverterU32.lower(value), ) @@ -1477,7 +1477,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 36, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i64 + 40, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i64 FfiConverterTypeRetourneur.lower(this), FfiConverterI64.lower(value), ) @@ -1502,7 +1502,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 37, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u64 + 41, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u64 FfiConverterTypeRetourneur.lower(this), FfiConverterU64.lower(value), ) @@ -1527,7 +1527,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 38, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_float + 42, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_float FfiConverterTypeRetourneur.lower(this), FfiConverterF32.lower(value), ) @@ -1552,7 +1552,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 39, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_double + 43, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_double FfiConverterTypeRetourneur.lower(this), FfiConverterF64.lower(value), ) @@ -1577,7 +1577,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 40, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_boolean + 44, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_boolean FfiConverterTypeRetourneur.lower(this), FfiConverterBool.lower(value), ) @@ -1602,7 +1602,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 41, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_string + 45, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_string FfiConverterTypeRetourneur.lower(this), FfiConverterString.lower(value), ) @@ -1627,7 +1627,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 42, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes + 46, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes FfiConverterTypeRetourneur.lower(this), FfiConverterTypeDictionnaireNombresSignes.lower(value), ) @@ -1652,7 +1652,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 43, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres + 47, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres FfiConverterTypeRetourneur.lower(this), FfiConverterTypeDictionnaireNombres.lower(value), ) @@ -1677,7 +1677,7 @@ export class Retourneur { throw e; } return UniFFIScaffolding.callAsync( - 44, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire + 48, // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire FfiConverterTypeRetourneur.lower(this), FfiConverterTypeOptionneurDictionnaire.lower(value), ) @@ -1740,7 +1740,7 @@ export class Stringifier { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 45, // rondpoint:uniffi_rondpoint_fn_constructor_stringifier_new + 49, // rondpoint:uniffi_rondpoint_fn_constructor_stringifier_new ) } try { @@ -1762,7 +1762,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 46, // rondpoint:uniffi_rondpoint_fn_method_stringifier_well_known_string + 50, // rondpoint:uniffi_rondpoint_fn_method_stringifier_well_known_string FfiConverterTypeStringifier.lower(this), FfiConverterString.lower(value), ) @@ -1787,7 +1787,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 47, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i8 + 51, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i8 FfiConverterTypeStringifier.lower(this), FfiConverterI8.lower(value), ) @@ -1812,7 +1812,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 48, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u8 + 52, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u8 FfiConverterTypeStringifier.lower(this), FfiConverterU8.lower(value), ) @@ -1837,7 +1837,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 49, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i16 + 53, // rondpoint: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( - 50, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u16 + 54, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u16 FfiConverterTypeStringifier.lower(this), FfiConverterU16.lower(value), ) @@ -1887,7 +1887,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 51, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i32 + 55, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i32 FfiConverterTypeStringifier.lower(this), FfiConverterI32.lower(value), ) @@ -1912,7 +1912,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 52, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u32 + 56, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u32 FfiConverterTypeStringifier.lower(this), FfiConverterU32.lower(value), ) @@ -1937,7 +1937,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 53, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i64 + 57, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i64 FfiConverterTypeStringifier.lower(this), FfiConverterI64.lower(value), ) @@ -1962,7 +1962,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 54, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u64 + 58, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u64 FfiConverterTypeStringifier.lower(this), FfiConverterU64.lower(value), ) @@ -1987,7 +1987,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 55, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_float + 59, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_float FfiConverterTypeStringifier.lower(this), FfiConverterF32.lower(value), ) @@ -2012,7 +2012,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 56, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_double + 60, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_double FfiConverterTypeStringifier.lower(this), FfiConverterF64.lower(value), ) @@ -2037,7 +2037,7 @@ export class Stringifier { throw e; } return UniFFIScaffolding.callAsync( - 57, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_boolean + 61, // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_boolean FfiConverterTypeStringifier.lower(this), FfiConverterBool.lower(value), ) @@ -3257,7 +3257,7 @@ export function copieDictionnaire(d) { throw e; } return UniFFIScaffolding.callAsync( - 84, // rondpoint:uniffi_rondpoint_fn_func_copie_dictionnaire + 88, // rondpoint:uniffi_rondpoint_fn_func_copie_dictionnaire FfiConverterTypeDictionnaire.lower(d), ) } @@ -3282,7 +3282,7 @@ export function copieEnumeration(e) { throw e; } return UniFFIScaffolding.callAsync( - 85, // rondpoint:uniffi_rondpoint_fn_func_copie_enumeration + 89, // rondpoint:uniffi_rondpoint_fn_func_copie_enumeration FfiConverterTypeEnumeration.lower(e), ) } @@ -3307,7 +3307,7 @@ export function copieEnumerations(e) { throw e; } return UniFFIScaffolding.callAsync( - 86, // rondpoint:uniffi_rondpoint_fn_func_copie_enumerations + 90, // rondpoint:uniffi_rondpoint_fn_func_copie_enumerations FfiConverterSequenceTypeEnumeration.lower(e), ) } @@ -3332,7 +3332,7 @@ export function copieCarte(c) { throw e; } return UniFFIScaffolding.callAsync( - 87, // rondpoint:uniffi_rondpoint_fn_func_copie_carte + 91, // rondpoint:uniffi_rondpoint_fn_func_copie_carte FfiConverterMapStringTypeEnumerationAvecDonnees.lower(c), ) } @@ -3357,7 +3357,7 @@ export function switcheroo(b) { throw e; } return UniFFIScaffolding.callAsync( - 88, // rondpoint:uniffi_rondpoint_fn_func_switcheroo + 92, // rondpoint:uniffi_rondpoint_fn_func_switcheroo FfiConverterBool.lower(b), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs index 268c7486cd5b..b967a086deb3 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustSprites.sys.mjs @@ -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 = 6; // sprites:Sprite + const pointerId = 7; // 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 = 6; // sprites:Sprite + const pointerId = 7; // 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( - 89, // sprites:uniffi_sprites_fn_constructor_sprite_new + 93, // sprites:uniffi_sprites_fn_constructor_sprite_new FfiConverterOptionalTypePoint.lower(initialPosition), ) } @@ -361,7 +361,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 90, // sprites:uniffi_sprites_fn_constructor_sprite_new_relative_to + 94, // sprites: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( - 91, // sprites:uniffi_sprites_fn_method_sprite_get_position + 95, // sprites:uniffi_sprites_fn_method_sprite_get_position FfiConverterTypeSprite.lower(this), ) } @@ -401,7 +401,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 92, // sprites:uniffi_sprites_fn_method_sprite_move_to + 96, // sprites:uniffi_sprites_fn_method_sprite_move_to FfiConverterTypeSprite.lower(this), FfiConverterTypePoint.lower(position), ) @@ -426,7 +426,7 @@ export class Sprite { throw e; } return UniFFIScaffolding.callAsync( - 93, // sprites:uniffi_sprites_fn_method_sprite_move_by + 97, // sprites:uniffi_sprites_fn_method_sprite_move_by FfiConverterTypeSprite.lower(this), FfiConverterTypeVector.lower(direction), ) @@ -668,7 +668,7 @@ export function translate(position,direction) { throw e; } return UniFFIScaffolding.callAsync( - 94, // sprites:uniffi_sprites_fn_func_translate + 98, // sprites:uniffi_sprites_fn_func_translate FfiConverterTypePoint.lower(position), FfiConverterTypeVector.lower(direction), ) diff --git a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs index 98dd5ee42370..65c9ab2544e9 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs +++ b/toolkit/components/uniffi-bindgen-gecko-js/fixtures/generated/RustTodolist.sys.mjs @@ -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 = 7; // todolist:TodoList + const pointerId = 8; // 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 = 7; // todolist:TodoList + const pointerId = 8; // 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( - 95, // todolist:uniffi_todolist_fn_constructor_todolist_new + 99, // todolist:uniffi_todolist_fn_constructor_todolist_new ) } try { @@ -320,7 +320,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 96, // todolist:uniffi_todolist_fn_method_todolist_add_item + 100, // todolist:uniffi_todolist_fn_method_todolist_add_item FfiConverterTypeTodoList.lower(this), FfiConverterString.lower(todo), ) @@ -345,7 +345,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 97, // todolist:uniffi_todolist_fn_method_todolist_add_entry + 101, // todolist:uniffi_todolist_fn_method_todolist_add_entry FfiConverterTypeTodoList.lower(this), FfiConverterTypeTodoEntry.lower(entry), ) @@ -362,7 +362,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 98, // todolist:uniffi_todolist_fn_method_todolist_get_entries + 102, // todolist:uniffi_todolist_fn_method_todolist_get_entries FfiConverterTypeTodoList.lower(this), ) } @@ -378,7 +378,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 99, // todolist:uniffi_todolist_fn_method_todolist_get_items + 103, // todolist:uniffi_todolist_fn_method_todolist_get_items FfiConverterTypeTodoList.lower(this), ) } @@ -402,7 +402,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 100, // todolist:uniffi_todolist_fn_method_todolist_add_entries + 104, // todolist:uniffi_todolist_fn_method_todolist_add_entries FfiConverterTypeTodoList.lower(this), FfiConverterSequenceTypeTodoEntry.lower(entries), ) @@ -427,7 +427,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 101, // todolist:uniffi_todolist_fn_method_todolist_add_items + 105, // todolist:uniffi_todolist_fn_method_todolist_add_items FfiConverterTypeTodoList.lower(this), FfiConverterSequencestring.lower(items), ) @@ -444,7 +444,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsync( - 102, // todolist:uniffi_todolist_fn_method_todolist_get_last_entry + 106, // todolist:uniffi_todolist_fn_method_todolist_get_last_entry FfiConverterTypeTodoList.lower(this), ) } @@ -460,7 +460,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsync( - 103, // todolist:uniffi_todolist_fn_method_todolist_get_last + 107, // todolist:uniffi_todolist_fn_method_todolist_get_last FfiConverterTypeTodoList.lower(this), ) } @@ -476,7 +476,7 @@ export class TodoList { const liftError = (data) => FfiConverterTypeTodoError.lift(data); const functionCall = () => { return UniFFIScaffolding.callAsync( - 104, // todolist:uniffi_todolist_fn_method_todolist_get_first + 108, // todolist:uniffi_todolist_fn_method_todolist_get_first FfiConverterTypeTodoList.lower(this), ) } @@ -500,7 +500,7 @@ export class TodoList { throw e; } return UniFFIScaffolding.callAsync( - 105, // todolist:uniffi_todolist_fn_method_todolist_clear_item + 109, // todolist:uniffi_todolist_fn_method_todolist_clear_item FfiConverterTypeTodoList.lower(this), FfiConverterString.lower(todo), ) @@ -517,7 +517,7 @@ export class TodoList { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 106, // todolist:uniffi_todolist_fn_method_todolist_make_default + 110, // todolist:uniffi_todolist_fn_method_todolist_make_default FfiConverterTypeTodoList.lower(this), ) } @@ -865,7 +865,7 @@ export function getDefaultList() { const liftError = null; const functionCall = () => { return UniFFIScaffolding.callAsync( - 107, // todolist:uniffi_todolist_fn_func_get_default_list + 111, // todolist:uniffi_todolist_fn_func_get_default_list ) } try { @@ -889,7 +889,7 @@ export function setDefaultList(list) { throw e; } return UniFFIScaffolding.callAsync( - 108, // todolist:uniffi_todolist_fn_func_set_default_list + 112, // todolist:uniffi_todolist_fn_func_set_default_list FfiConverterTypeTodoList.lower(list), ) } @@ -914,7 +914,7 @@ export function createEntryWith(todo) { throw e; } return UniFFIScaffolding.callAsync( - 109, // todolist:uniffi_todolist_fn_func_create_entry_with + 113, // todolist:uniffi_todolist_fn_func_create_entry_with FfiConverterString.lower(todo), ) } diff --git a/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py b/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py index 4b8e7e85ee94..215b2a9667e0 100644 --- a/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py +++ b/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py @@ -14,6 +14,7 @@ UDL_FILES = [ "third_party/rust/sync15/src/sync15.udl", "third_party/rust/tabs/src/tabs.udl", "third_party/rust/suggest/src/suggest.udl", + "third_party/rust/remote_settings/src/remote_settings.udl", ] FIXTURE_UDL_FILES = [ diff --git a/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp b/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp index 57d4ab6c530e..bab8d75671c6 100644 --- a/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp +++ b/toolkit/components/uniffi-js/UniFFIFixtureScaffolding.cpp @@ -177,367 +177,367 @@ Maybe UniFFIFixturesGetCallbackInterfaceInfo(uint64_t aIn Maybe> UniFFIFixturesCallAsync(const GlobalObject& aGlobal, uint64_t aId, const Sequence& aArgs, ErrorResult& aError) { switch (aId) { - case 23: { // geometry:uniffi_geometry_fn_func_gradient + case 27: { // geometry:uniffi_geometry_fn_func_gradient using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_geometry_fn_func_gradient, aGlobal, aArgs, "uniffi_geometry_fn_func_gradient: "_ns, aError)); } - case 24: { // geometry:uniffi_geometry_fn_func_intersection + case 28: { // geometry:uniffi_geometry_fn_func_intersection using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_geometry_fn_func_intersection, aGlobal, aArgs, "uniffi_geometry_fn_func_intersection: "_ns, aError)); } - case 25: { // arithmetic:uniffi_arithmetic_fn_func_add + case 29: { // arithmetic:uniffi_arithmetic_fn_func_add using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_arithmetic_fn_func_add, aGlobal, aArgs, "uniffi_arithmetic_fn_func_add: "_ns, aError)); } - case 26: { // arithmetic:uniffi_arithmetic_fn_func_sub + case 30: { // arithmetic:uniffi_arithmetic_fn_func_sub using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_arithmetic_fn_func_sub, aGlobal, aArgs, "uniffi_arithmetic_fn_func_sub: "_ns, aError)); } - case 27: { // arithmetic:uniffi_arithmetic_fn_func_div + case 31: { // arithmetic:uniffi_arithmetic_fn_func_div using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_arithmetic_fn_func_div, aGlobal, aArgs, "uniffi_arithmetic_fn_func_div: "_ns, aError)); } - case 28: { // arithmetic:uniffi_arithmetic_fn_func_equal + case 32: { // arithmetic:uniffi_arithmetic_fn_func_equal using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_arithmetic_fn_func_equal, aGlobal, aArgs, "uniffi_arithmetic_fn_func_equal: "_ns, aError)); } - case 29: { // rondpoint:uniffi_rondpoint_fn_constructor_retourneur_new + case 33: { // rondpoint:uniffi_rondpoint_fn_constructor_retourneur_new using CallHandler = ScaffoldingCallHandler>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_constructor_retourneur_new, aGlobal, aArgs, "uniffi_rondpoint_fn_constructor_retourneur_new: "_ns, aError)); } - case 30: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i8 + case 34: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_i8, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_i8: "_ns, aError)); } - case 31: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u8 + case 35: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_u8, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_u8: "_ns, aError)); } - case 32: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i16 + case 36: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_i16, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_i16: "_ns, aError)); } - case 33: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u16 + case 37: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_u16, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_u16: "_ns, aError)); } - case 34: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i32 + case 38: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_i32, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_i32: "_ns, aError)); } - case 35: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u32 + case 39: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_u32, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_u32: "_ns, aError)); } - case 36: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i64 + case 40: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_i64, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_i64: "_ns, aError)); } - case 37: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u64 + case 41: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_u64, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_u64: "_ns, aError)); } - case 38: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_float + case 42: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_float using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_float, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_float: "_ns, aError)); } - case 39: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_double + case 43: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_double using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_double, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_double: "_ns, aError)); } - case 40: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_boolean + case 44: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_boolean using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_boolean, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_boolean: "_ns, aError)); } - case 41: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_string + case 45: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_string using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_string, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_string: "_ns, aError)); } - case 42: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes + case 46: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes: "_ns, aError)); } - case 43: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres + case 47: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_nombres, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_nombres: "_ns, aError)); } - case 44: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire + case 48: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire, aGlobal, aArgs, "uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire: "_ns, aError)); } - case 45: { // rondpoint:uniffi_rondpoint_fn_constructor_stringifier_new + case 49: { // rondpoint:uniffi_rondpoint_fn_constructor_stringifier_new using CallHandler = ScaffoldingCallHandler>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_constructor_stringifier_new, aGlobal, aArgs, "uniffi_rondpoint_fn_constructor_stringifier_new: "_ns, aError)); } - case 46: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_well_known_string + case 50: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_well_known_string using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_well_known_string, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_well_known_string: "_ns, aError)); } - case 47: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i8 + case 51: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_i8, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_i8: "_ns, aError)); } - case 48: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u8 + case 52: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_u8, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_u8: "_ns, aError)); } - case 49: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i16 + case 53: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_i16, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_i16: "_ns, aError)); } - case 50: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u16 + case 54: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_u16, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_u16: "_ns, aError)); } - case 51: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i32 + case 55: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_i32, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_i32: "_ns, aError)); } - case 52: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u32 + case 56: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_u32, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_u32: "_ns, aError)); } - case 53: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i64 + case 57: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_i64, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_i64: "_ns, aError)); } - case 54: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u64 + case 58: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_u64, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_u64: "_ns, aError)); } - case 55: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_float + case 59: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_float using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_float, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_float: "_ns, aError)); } - case 56: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_double + case 60: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_double using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_double, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_double: "_ns, aError)); } - case 57: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_boolean + case 61: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_boolean using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_stringifier_to_string_boolean, aGlobal, aArgs, "uniffi_rondpoint_fn_method_stringifier_to_string_boolean: "_ns, aError)); } - case 58: { // rondpoint:uniffi_rondpoint_fn_constructor_optionneur_new + case 62: { // rondpoint:uniffi_rondpoint_fn_constructor_optionneur_new using CallHandler = ScaffoldingCallHandler>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_constructor_optionneur_new, aGlobal, aArgs, "uniffi_rondpoint_fn_constructor_optionneur_new: "_ns, aError)); } - case 59: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_boolean + case 63: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_boolean using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_boolean, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_boolean: "_ns, aError)); } - case 60: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_string + case 64: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_string using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_string, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_string: "_ns, aError)); } - case 61: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_sequence + case 65: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_sequence using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_sequence, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_sequence: "_ns, aError)); } - case 62: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_null + case 66: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_null using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_null, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_null: "_ns, aError)); } - case 63: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_zero + case 67: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_zero using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_zero, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_zero: "_ns, aError)); } - case 64: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec + case 68: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec: "_ns, aError)); } - case 65: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec + case 69: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec: "_ns, aError)); } - case 66: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec + case 70: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec: "_ns, aError)); } - case 67: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec + case 71: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec: "_ns, aError)); } - case 68: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec + case 72: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec: "_ns, aError)); } - case 69: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec + case 73: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec: "_ns, aError)); } - case 70: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec + case 74: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec: "_ns, aError)); } - case 71: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec + case 75: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec: "_ns, aError)); } - case 72: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex + case 76: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex: "_ns, aError)); } - case 73: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex + case 77: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex: "_ns, aError)); } - case 74: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex + case 78: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex: "_ns, aError)); } - case 75: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex + case 79: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex: "_ns, aError)); } - case 76: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex + case 80: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex: "_ns, aError)); } - case 77: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex + case 81: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex: "_ns, aError)); } - case 78: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex + case 82: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex: "_ns, aError)); } - case 79: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex + case 83: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex: "_ns, aError)); } - case 80: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct + case 84: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct: "_ns, aError)); } - case 81: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f32 + case 85: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_f32, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_f32: "_ns, aError)); } - case 82: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f64 + case 86: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_f64, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_f64: "_ns, aError)); } - case 83: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_enum + case 87: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_enum using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_method_optionneur_sinon_enum, aGlobal, aArgs, "uniffi_rondpoint_fn_method_optionneur_sinon_enum: "_ns, aError)); } - case 84: { // rondpoint:uniffi_rondpoint_fn_func_copie_dictionnaire + case 88: { // rondpoint:uniffi_rondpoint_fn_func_copie_dictionnaire using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_func_copie_dictionnaire, aGlobal, aArgs, "uniffi_rondpoint_fn_func_copie_dictionnaire: "_ns, aError)); } - case 85: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumeration + case 89: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumeration using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_func_copie_enumeration, aGlobal, aArgs, "uniffi_rondpoint_fn_func_copie_enumeration: "_ns, aError)); } - case 86: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumerations + case 90: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumerations using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_func_copie_enumerations, aGlobal, aArgs, "uniffi_rondpoint_fn_func_copie_enumerations: "_ns, aError)); } - case 87: { // rondpoint:uniffi_rondpoint_fn_func_copie_carte + case 91: { // rondpoint:uniffi_rondpoint_fn_func_copie_carte using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_func_copie_carte, aGlobal, aArgs, "uniffi_rondpoint_fn_func_copie_carte: "_ns, aError)); } - case 88: { // rondpoint:uniffi_rondpoint_fn_func_switcheroo + case 92: { // rondpoint:uniffi_rondpoint_fn_func_switcheroo using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_rondpoint_fn_func_switcheroo, aGlobal, aArgs, "uniffi_rondpoint_fn_func_switcheroo: "_ns, aError)); } - case 89: { // sprites:uniffi_sprites_fn_constructor_sprite_new + case 93: { // sprites:uniffi_sprites_fn_constructor_sprite_new using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_sprites_fn_constructor_sprite_new, aGlobal, aArgs, "uniffi_sprites_fn_constructor_sprite_new: "_ns, aError)); } - case 90: { // sprites:uniffi_sprites_fn_constructor_sprite_new_relative_to + case 94: { // sprites:uniffi_sprites_fn_constructor_sprite_new_relative_to using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_sprites_fn_constructor_sprite_new_relative_to, aGlobal, aArgs, "uniffi_sprites_fn_constructor_sprite_new_relative_to: "_ns, aError)); } - case 91: { // sprites:uniffi_sprites_fn_method_sprite_get_position + case 95: { // sprites:uniffi_sprites_fn_method_sprite_get_position using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSpritesSpritePointerType>>; return Some(CallHandler::CallAsync(uniffi_sprites_fn_method_sprite_get_position, aGlobal, aArgs, "uniffi_sprites_fn_method_sprite_get_position: "_ns, aError)); } - case 92: { // sprites:uniffi_sprites_fn_method_sprite_move_to + case 96: { // sprites:uniffi_sprites_fn_method_sprite_move_to using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSpritesSpritePointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_sprites_fn_method_sprite_move_to, aGlobal, aArgs, "uniffi_sprites_fn_method_sprite_move_to: "_ns, aError)); } - case 93: { // sprites:uniffi_sprites_fn_method_sprite_move_by + case 97: { // sprites:uniffi_sprites_fn_method_sprite_move_by using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSpritesSpritePointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_sprites_fn_method_sprite_move_by, aGlobal, aArgs, "uniffi_sprites_fn_method_sprite_move_by: "_ns, aError)); } - case 94: { // sprites:uniffi_sprites_fn_func_translate + case 98: { // sprites:uniffi_sprites_fn_func_translate using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_sprites_fn_func_translate, aGlobal, aArgs, "uniffi_sprites_fn_func_translate: "_ns, aError)); } - case 95: { // todolist:uniffi_todolist_fn_constructor_todolist_new + case 99: { // todolist:uniffi_todolist_fn_constructor_todolist_new using CallHandler = ScaffoldingCallHandler>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_constructor_todolist_new, aGlobal, aArgs, "uniffi_todolist_fn_constructor_todolist_new: "_ns, aError)); } - case 96: { // todolist:uniffi_todolist_fn_method_todolist_add_item + case 100: { // todolist:uniffi_todolist_fn_method_todolist_add_item using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_add_item, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_add_item: "_ns, aError)); } - case 97: { // todolist:uniffi_todolist_fn_method_todolist_add_entry + case 101: { // todolist:uniffi_todolist_fn_method_todolist_add_entry using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_add_entry, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_add_entry: "_ns, aError)); } - case 98: { // todolist:uniffi_todolist_fn_method_todolist_get_entries + case 102: { // todolist:uniffi_todolist_fn_method_todolist_get_entries using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_get_entries, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_get_entries: "_ns, aError)); } - case 99: { // todolist:uniffi_todolist_fn_method_todolist_get_items + case 103: { // todolist:uniffi_todolist_fn_method_todolist_get_items using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_get_items, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_get_items: "_ns, aError)); } - case 100: { // todolist:uniffi_todolist_fn_method_todolist_add_entries + case 104: { // todolist:uniffi_todolist_fn_method_todolist_add_entries using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_add_entries, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_add_entries: "_ns, aError)); } - case 101: { // todolist:uniffi_todolist_fn_method_todolist_add_items + case 105: { // todolist:uniffi_todolist_fn_method_todolist_add_items using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_add_items, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_add_items: "_ns, aError)); } - case 102: { // todolist:uniffi_todolist_fn_method_todolist_get_last_entry + case 106: { // todolist:uniffi_todolist_fn_method_todolist_get_last_entry using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_get_last_entry, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_get_last_entry: "_ns, aError)); } - case 103: { // todolist:uniffi_todolist_fn_method_todolist_get_last + case 107: { // todolist:uniffi_todolist_fn_method_todolist_get_last using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_get_last, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_get_last: "_ns, aError)); } - case 104: { // todolist:uniffi_todolist_fn_method_todolist_get_first + case 108: { // todolist:uniffi_todolist_fn_method_todolist_get_first using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_get_first, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_get_first: "_ns, aError)); } - case 105: { // todolist:uniffi_todolist_fn_method_todolist_clear_item + case 109: { // todolist:uniffi_todolist_fn_method_todolist_clear_item using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_clear_item, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_clear_item: "_ns, aError)); } - case 106: { // todolist:uniffi_todolist_fn_method_todolist_make_default + case 110: { // todolist:uniffi_todolist_fn_method_todolist_make_default using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_method_todolist_make_default, aGlobal, aArgs, "uniffi_todolist_fn_method_todolist_make_default: "_ns, aError)); } - case 107: { // todolist:uniffi_todolist_fn_func_get_default_list + case 111: { // todolist:uniffi_todolist_fn_func_get_default_list using CallHandler = ScaffoldingCallHandler>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_func_get_default_list, aGlobal, aArgs, "uniffi_todolist_fn_func_get_default_list: "_ns, aError)); } - case 108: { // todolist:uniffi_todolist_fn_func_set_default_list + case 112: { // todolist:uniffi_todolist_fn_func_set_default_list using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_func_set_default_list, aGlobal, aArgs, "uniffi_todolist_fn_func_set_default_list: "_ns, aError)); } - case 109: { // todolist:uniffi_todolist_fn_func_create_entry_with + case 113: { // todolist:uniffi_todolist_fn_func_create_entry_with using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_todolist_fn_func_create_entry_with, aGlobal, aArgs, "uniffi_todolist_fn_func_create_entry_with: "_ns, aError)); } - case 110: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers + case 114: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_fixture_callbacks_fn_func_log_even_numbers, aGlobal, aArgs, "uniffi_fixture_callbacks_fn_func_log_even_numbers: "_ns, aError)); } - case 111: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread + case 115: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread, aGlobal, aArgs, "uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread: "_ns, aError)); } - case 112: { // custom_types:uniffi_custom_types_fn_func_get_custom_types_demo + case 116: { // custom_types:uniffi_custom_types_fn_func_get_custom_types_demo using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_custom_types_fn_func_get_custom_types_demo, aGlobal, aArgs, "uniffi_custom_types_fn_func_get_custom_types_demo: "_ns, aError)); } - case 113: { // external_types:uniffi_external_types_fn_func_gradient + case 117: { // external_types:uniffi_external_types_fn_func_gradient using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; return Some(CallHandler::CallAsync(uniffi_external_types_fn_func_gradient, aGlobal, aArgs, "uniffi_external_types_fn_func_gradient: "_ns, aError)); } @@ -547,457 +547,457 @@ Maybe> UniFFIFixturesCallAsync(const GlobalObject& aGl bool UniFFIFixturesCallSync(const GlobalObject& aGlobal, uint64_t aId, const Sequence& aArgs, RootedDictionary& aReturnValue, ErrorResult& aError) { switch (aId) { - case 23: { // geometry:uniffi_geometry_fn_func_gradient + case 27: { // geometry:uniffi_geometry_fn_func_gradient using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_geometry_fn_func_gradient, aGlobal, aArgs, aReturnValue, "uniffi_geometry_fn_func_gradient: "_ns, aError); return true; } - case 24: { // geometry:uniffi_geometry_fn_func_intersection + case 28: { // geometry:uniffi_geometry_fn_func_intersection using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_geometry_fn_func_intersection, aGlobal, aArgs, aReturnValue, "uniffi_geometry_fn_func_intersection: "_ns, aError); return true; } - case 25: { // arithmetic:uniffi_arithmetic_fn_func_add + case 29: { // arithmetic:uniffi_arithmetic_fn_func_add using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_arithmetic_fn_func_add, aGlobal, aArgs, aReturnValue, "uniffi_arithmetic_fn_func_add: "_ns, aError); return true; } - case 26: { // arithmetic:uniffi_arithmetic_fn_func_sub + case 30: { // arithmetic:uniffi_arithmetic_fn_func_sub using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_arithmetic_fn_func_sub, aGlobal, aArgs, aReturnValue, "uniffi_arithmetic_fn_func_sub: "_ns, aError); return true; } - case 27: { // arithmetic:uniffi_arithmetic_fn_func_div + case 31: { // arithmetic:uniffi_arithmetic_fn_func_div using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_arithmetic_fn_func_div, aGlobal, aArgs, aReturnValue, "uniffi_arithmetic_fn_func_div: "_ns, aError); return true; } - case 28: { // arithmetic:uniffi_arithmetic_fn_func_equal + case 32: { // arithmetic:uniffi_arithmetic_fn_func_equal using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_arithmetic_fn_func_equal, aGlobal, aArgs, aReturnValue, "uniffi_arithmetic_fn_func_equal: "_ns, aError); return true; } - case 29: { // rondpoint:uniffi_rondpoint_fn_constructor_retourneur_new + case 33: { // rondpoint:uniffi_rondpoint_fn_constructor_retourneur_new using CallHandler = ScaffoldingCallHandler>; CallHandler::CallSync(uniffi_rondpoint_fn_constructor_retourneur_new, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_constructor_retourneur_new: "_ns, aError); return true; } - case 30: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i8 + case 34: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_i8, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_i8: "_ns, aError); return true; } - case 31: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u8 + case 35: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_u8, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_u8: "_ns, aError); return true; } - case 32: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i16 + case 36: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_i16, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_i16: "_ns, aError); return true; } - case 33: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u16 + case 37: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_u16, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_u16: "_ns, aError); return true; } - case 34: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i32 + case 38: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_i32, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_i32: "_ns, aError); return true; } - case 35: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u32 + case 39: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_u32, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_u32: "_ns, aError); return true; } - case 36: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i64 + case 40: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_i64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_i64, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_i64: "_ns, aError); return true; } - case 37: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u64 + case 41: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_u64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_u64, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_u64: "_ns, aError); return true; } - case 38: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_float + case 42: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_float using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_float, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_float: "_ns, aError); return true; } - case 39: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_double + case 43: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_double using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_double, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_double: "_ns, aError); return true; } - case 40: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_boolean + case 44: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_boolean using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_boolean, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_boolean: "_ns, aError); return true; } - case 41: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_string + case 45: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_string using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_string, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_string: "_ns, aError); return true; } - case 42: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes + case 46: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes: "_ns, aError); return true; } - case 43: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres + case 47: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_nombres using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_nombres, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_nombres: "_ns, aError); return true; } - case 44: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire + case 48: { // rondpoint:uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointRetourneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire: "_ns, aError); return true; } - case 45: { // rondpoint:uniffi_rondpoint_fn_constructor_stringifier_new + case 49: { // rondpoint:uniffi_rondpoint_fn_constructor_stringifier_new using CallHandler = ScaffoldingCallHandler>; CallHandler::CallSync(uniffi_rondpoint_fn_constructor_stringifier_new, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_constructor_stringifier_new: "_ns, aError); return true; } - case 46: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_well_known_string + case 50: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_well_known_string using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_well_known_string, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_well_known_string: "_ns, aError); return true; } - case 47: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i8 + case 51: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_i8, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_i8: "_ns, aError); return true; } - case 48: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u8 + case 52: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u8 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_u8, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_u8: "_ns, aError); return true; } - case 49: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i16 + case 53: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_i16, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_i16: "_ns, aError); return true; } - case 50: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u16 + case 54: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u16 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_u16, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_u16: "_ns, aError); return true; } - case 51: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i32 + case 55: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_i32, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_i32: "_ns, aError); return true; } - case 52: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u32 + case 56: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_u32, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_u32: "_ns, aError); return true; } - case 53: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i64 + case 57: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_i64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_i64, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_i64: "_ns, aError); return true; } - case 54: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u64 + case 58: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_u64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_u64, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_u64: "_ns, aError); return true; } - case 55: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_float + case 59: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_float using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_float, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_float: "_ns, aError); return true; } - case 56: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_double + case 60: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_double using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_double, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_double: "_ns, aError); return true; } - case 57: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_boolean + case 61: { // rondpoint:uniffi_rondpoint_fn_method_stringifier_to_string_boolean using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointStringifierPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_stringifier_to_string_boolean, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_stringifier_to_string_boolean: "_ns, aError); return true; } - case 58: { // rondpoint:uniffi_rondpoint_fn_constructor_optionneur_new + case 62: { // rondpoint:uniffi_rondpoint_fn_constructor_optionneur_new using CallHandler = ScaffoldingCallHandler>; CallHandler::CallSync(uniffi_rondpoint_fn_constructor_optionneur_new, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_constructor_optionneur_new: "_ns, aError); return true; } - case 59: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_boolean + case 63: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_boolean using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_boolean, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_boolean: "_ns, aError); return true; } - case 60: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_string + case 64: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_string using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_string, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_string: "_ns, aError); return true; } - case 61: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_sequence + case 65: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_sequence using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_sequence, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_sequence: "_ns, aError); return true; } - case 62: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_null + case 66: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_null using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_null, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_null: "_ns, aError); return true; } - case 63: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_zero + case 67: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_zero using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_zero, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_zero: "_ns, aError); return true; } - case 64: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec + case 68: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec: "_ns, aError); return true; } - case 65: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec + case 69: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec: "_ns, aError); return true; } - case 66: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec + case 70: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec: "_ns, aError); return true; } - case 67: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec + case 71: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec: "_ns, aError); return true; } - case 68: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec + case 72: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec: "_ns, aError); return true; } - case 69: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec + case 73: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec: "_ns, aError); return true; } - case 70: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec + case 74: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec: "_ns, aError); return true; } - case 71: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec + case 75: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec: "_ns, aError); return true; } - case 72: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex + case 76: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex: "_ns, aError); return true; } - case 73: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex + case 77: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex: "_ns, aError); return true; } - case 74: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex + case 78: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex: "_ns, aError); return true; } - case 75: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex + case 79: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex: "_ns, aError); return true; } - case 76: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex + case 80: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex: "_ns, aError); return true; } - case 77: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex + case 81: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex: "_ns, aError); return true; } - case 78: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex + case 82: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex: "_ns, aError); return true; } - case 79: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex + case 83: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex: "_ns, aError); return true; } - case 80: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct + case 84: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct: "_ns, aError); return true; } - case 81: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f32 + case 85: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f32 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_f32, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_f32: "_ns, aError); return true; } - case 82: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f64 + case 86: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_f64 using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_f64, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_f64: "_ns, aError); return true; } - case 83: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_enum + case 87: { // rondpoint:uniffi_rondpoint_fn_method_optionneur_sinon_enum using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRondpointOptionneurPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_method_optionneur_sinon_enum, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_method_optionneur_sinon_enum: "_ns, aError); return true; } - case 84: { // rondpoint:uniffi_rondpoint_fn_func_copie_dictionnaire + case 88: { // rondpoint:uniffi_rondpoint_fn_func_copie_dictionnaire using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_func_copie_dictionnaire, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_func_copie_dictionnaire: "_ns, aError); return true; } - case 85: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumeration + case 89: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumeration using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_func_copie_enumeration, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_func_copie_enumeration: "_ns, aError); return true; } - case 86: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumerations + case 90: { // rondpoint:uniffi_rondpoint_fn_func_copie_enumerations using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_func_copie_enumerations, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_func_copie_enumerations: "_ns, aError); return true; } - case 87: { // rondpoint:uniffi_rondpoint_fn_func_copie_carte + case 91: { // rondpoint:uniffi_rondpoint_fn_func_copie_carte using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_func_copie_carte, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_func_copie_carte: "_ns, aError); return true; } - case 88: { // rondpoint:uniffi_rondpoint_fn_func_switcheroo + case 92: { // rondpoint:uniffi_rondpoint_fn_func_switcheroo using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_rondpoint_fn_func_switcheroo, aGlobal, aArgs, aReturnValue, "uniffi_rondpoint_fn_func_switcheroo: "_ns, aError); return true; } - case 89: { // sprites:uniffi_sprites_fn_constructor_sprite_new + case 93: { // sprites:uniffi_sprites_fn_constructor_sprite_new using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_sprites_fn_constructor_sprite_new, aGlobal, aArgs, aReturnValue, "uniffi_sprites_fn_constructor_sprite_new: "_ns, aError); return true; } - case 90: { // sprites:uniffi_sprites_fn_constructor_sprite_new_relative_to + case 94: { // sprites:uniffi_sprites_fn_constructor_sprite_new_relative_to using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_sprites_fn_constructor_sprite_new_relative_to, aGlobal, aArgs, aReturnValue, "uniffi_sprites_fn_constructor_sprite_new_relative_to: "_ns, aError); return true; } - case 91: { // sprites:uniffi_sprites_fn_method_sprite_get_position + case 95: { // sprites:uniffi_sprites_fn_method_sprite_get_position using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSpritesSpritePointerType>>; CallHandler::CallSync(uniffi_sprites_fn_method_sprite_get_position, aGlobal, aArgs, aReturnValue, "uniffi_sprites_fn_method_sprite_get_position: "_ns, aError); return true; } - case 92: { // sprites:uniffi_sprites_fn_method_sprite_move_to + case 96: { // sprites:uniffi_sprites_fn_method_sprite_move_to using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSpritesSpritePointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_sprites_fn_method_sprite_move_to, aGlobal, aArgs, aReturnValue, "uniffi_sprites_fn_method_sprite_move_to: "_ns, aError); return true; } - case 93: { // sprites:uniffi_sprites_fn_method_sprite_move_by + case 97: { // sprites:uniffi_sprites_fn_method_sprite_move_by using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSpritesSpritePointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_sprites_fn_method_sprite_move_by, aGlobal, aArgs, aReturnValue, "uniffi_sprites_fn_method_sprite_move_by: "_ns, aError); return true; } - case 94: { // sprites:uniffi_sprites_fn_func_translate + case 98: { // sprites:uniffi_sprites_fn_func_translate using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_sprites_fn_func_translate, aGlobal, aArgs, aReturnValue, "uniffi_sprites_fn_func_translate: "_ns, aError); return true; } - case 95: { // todolist:uniffi_todolist_fn_constructor_todolist_new + case 99: { // todolist:uniffi_todolist_fn_constructor_todolist_new using CallHandler = ScaffoldingCallHandler>; CallHandler::CallSync(uniffi_todolist_fn_constructor_todolist_new, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_constructor_todolist_new: "_ns, aError); return true; } - case 96: { // todolist:uniffi_todolist_fn_method_todolist_add_item + case 100: { // todolist:uniffi_todolist_fn_method_todolist_add_item using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_add_item, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_add_item: "_ns, aError); return true; } - case 97: { // todolist:uniffi_todolist_fn_method_todolist_add_entry + case 101: { // todolist:uniffi_todolist_fn_method_todolist_add_entry using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_add_entry, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_add_entry: "_ns, aError); return true; } - case 98: { // todolist:uniffi_todolist_fn_method_todolist_get_entries + case 102: { // todolist:uniffi_todolist_fn_method_todolist_get_entries using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_get_entries, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_get_entries: "_ns, aError); return true; } - case 99: { // todolist:uniffi_todolist_fn_method_todolist_get_items + case 103: { // todolist:uniffi_todolist_fn_method_todolist_get_items using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_get_items, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_get_items: "_ns, aError); return true; } - case 100: { // todolist:uniffi_todolist_fn_method_todolist_add_entries + case 104: { // todolist:uniffi_todolist_fn_method_todolist_add_entries using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_add_entries, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_add_entries: "_ns, aError); return true; } - case 101: { // todolist:uniffi_todolist_fn_method_todolist_add_items + case 105: { // todolist:uniffi_todolist_fn_method_todolist_add_items using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_add_items, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_add_items: "_ns, aError); return true; } - case 102: { // todolist:uniffi_todolist_fn_method_todolist_get_last_entry + case 106: { // todolist:uniffi_todolist_fn_method_todolist_get_last_entry using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_get_last_entry, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_get_last_entry: "_ns, aError); return true; } - case 103: { // todolist:uniffi_todolist_fn_method_todolist_get_last + case 107: { // todolist:uniffi_todolist_fn_method_todolist_get_last using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_get_last, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_get_last: "_ns, aError); return true; } - case 104: { // todolist:uniffi_todolist_fn_method_todolist_get_first + case 108: { // todolist:uniffi_todolist_fn_method_todolist_get_first using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_get_first, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_get_first: "_ns, aError); return true; } - case 105: { // todolist:uniffi_todolist_fn_method_todolist_clear_item + case 109: { // todolist:uniffi_todolist_fn_method_todolist_clear_item using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>, ScaffoldingConverter>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_clear_item, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_clear_item: "_ns, aError); return true; } - case 106: { // todolist:uniffi_todolist_fn_method_todolist_make_default + case 110: { // todolist:uniffi_todolist_fn_method_todolist_make_default using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_method_todolist_make_default, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_method_todolist_make_default: "_ns, aError); return true; } - case 107: { // todolist:uniffi_todolist_fn_func_get_default_list + case 111: { // todolist:uniffi_todolist_fn_func_get_default_list using CallHandler = ScaffoldingCallHandler>; CallHandler::CallSync(uniffi_todolist_fn_func_get_default_list, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_func_get_default_list: "_ns, aError); return true; } - case 108: { // todolist:uniffi_todolist_fn_func_set_default_list + case 112: { // todolist:uniffi_todolist_fn_func_set_default_list using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kTodolistTodoListPointerType>>; CallHandler::CallSync(uniffi_todolist_fn_func_set_default_list, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_func_set_default_list: "_ns, aError); return true; } - case 109: { // todolist:uniffi_todolist_fn_func_create_entry_with + case 113: { // todolist:uniffi_todolist_fn_func_create_entry_with using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_todolist_fn_func_create_entry_with, aGlobal, aArgs, aReturnValue, "uniffi_todolist_fn_func_create_entry_with: "_ns, aError); return true; } - case 110: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers + case 114: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_fixture_callbacks_fn_func_log_even_numbers, aGlobal, aArgs, aReturnValue, "uniffi_fixture_callbacks_fn_func_log_even_numbers: "_ns, aError); return true; } - case 111: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread + case 115: { // fixture_callbacks:uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter, ScaffoldingConverter>; CallHandler::CallSync(uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread, aGlobal, aArgs, aReturnValue, "uniffi_fixture_callbacks_fn_func_log_even_numbers_main_thread: "_ns, aError); return true; } - case 112: { // custom_types:uniffi_custom_types_fn_func_get_custom_types_demo + case 116: { // custom_types:uniffi_custom_types_fn_func_get_custom_types_demo using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_custom_types_fn_func_get_custom_types_demo, aGlobal, aArgs, aReturnValue, "uniffi_custom_types_fn_func_get_custom_types_demo: "_ns, aError); return true; } - case 113: { // external_types:uniffi_external_types_fn_func_gradient + case 117: { // external_types:uniffi_external_types_fn_func_gradient using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; CallHandler::CallSync(uniffi_external_types_fn_func_gradient, aGlobal, aArgs, aReturnValue, "uniffi_external_types_fn_func_gradient: "_ns, aError); return true; @@ -1009,23 +1009,23 @@ bool UniFFIFixturesCallSync(const GlobalObject& aGlobal, uint64_t aId, const Seq Maybe> UniFFIFixturesReadPointer(const GlobalObject& aGlobal, uint64_t aId, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) { const UniFFIPointerType* type; switch (aId) { - case 3: { // rondpoint:Retourneur + case 4: { // rondpoint:Retourneur type = &kRondpointRetourneurPointerType; break; } - case 4: { // rondpoint:Stringifier + case 5: { // rondpoint:Stringifier type = &kRondpointStringifierPointerType; break; } - case 5: { // rondpoint:Optionneur + case 6: { // rondpoint:Optionneur type = &kRondpointOptionneurPointerType; break; } - case 6: { // sprites:Sprite + case 7: { // sprites:Sprite type = &kSpritesSpritePointerType; break; } - case 7: { // todolist:TodoList + case 8: { // todolist:TodoList type = &kTodolistTodoListPointerType; break; } @@ -1038,23 +1038,23 @@ Maybe> UniFFIFixturesReadPointer(const GlobalObj bool UniFFIFixturesWritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer& aPtr, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) { const UniFFIPointerType* type; switch (aId) { - case 3: { // rondpoint:Retourneur + case 4: { // rondpoint:Retourneur type = &kRondpointRetourneurPointerType; break; } - case 4: { // rondpoint:Stringifier + case 5: { // rondpoint:Stringifier type = &kRondpointStringifierPointerType; break; } - case 5: { // rondpoint:Optionneur + case 6: { // rondpoint:Optionneur type = &kRondpointOptionneurPointerType; break; } - case 6: { // sprites:Sprite + case 7: { // sprites:Sprite type = &kSpritesSpritePointerType; break; } - case 7: { // todolist:TodoList + case 8: { // todolist:TodoList type = &kTodolistTodoListPointerType; break; } diff --git a/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp b/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp index 031a5f66035e..606f3b4effd0 100644 --- a/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp +++ b/toolkit/components/uniffi-js/UniFFIGeneratedScaffolding.cpp @@ -50,6 +50,11 @@ extern "C" { void uniffi_suggest_fn_method_suggeststore_interrupt(void *, RustCallStatus*); void uniffi_suggest_fn_method_suggeststore_ingest(void *, RustBuffer, RustCallStatus*); void uniffi_suggest_fn_method_suggeststore_clear(void *, RustCallStatus*); + void uniffi_remote_settings_fn_free_remotesettings(void *, RustCallStatus*); + void * uniffi_remote_settings_fn_constructor_remotesettings_new(RustBuffer, RustCallStatus*); + RustBuffer uniffi_remote_settings_fn_method_remotesettings_get_records(void *, RustCallStatus*); + RustBuffer uniffi_remote_settings_fn_method_remotesettings_get_records_since(void *, uint64_t, RustCallStatus*); + void uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path(void *, RustBuffer, RustBuffer, RustCallStatus*); } // Define pointer types @@ -65,6 +70,10 @@ const static mozilla::uniffi::UniFFIPointerType kSuggestSuggestStorePointerType "suggest::SuggestStore"_ns, uniffi_suggest_fn_free_suggeststore }; +const static mozilla::uniffi::UniFFIPointerType kRemoteSettingsRemoteSettingsPointerType { + "remote_settings::RemoteSettings"_ns, + uniffi_remote_settings_fn_free_remotesettings +}; // Define the data we need per-callback interface @@ -171,6 +180,22 @@ Maybe> UniFFICallAsync(const GlobalObject& aGlobal, ui using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>>; return Some(CallHandler::CallAsync(uniffi_suggest_fn_method_suggeststore_clear, aGlobal, aArgs, "uniffi_suggest_fn_method_suggeststore_clear: "_ns, aError)); } + case 23: { // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new + using CallHandler = ScaffoldingCallHandler, ScaffoldingConverter>; + return Some(CallHandler::CallAsync(uniffi_remote_settings_fn_constructor_remotesettings_new, aGlobal, aArgs, "uniffi_remote_settings_fn_constructor_remotesettings_new: "_ns, aError)); + } + case 24: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records + using CallHandler = ScaffoldingCallHandler, 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 25: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since + using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter>; + 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 26: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path + using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter, ScaffoldingConverter>; + 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)); + } } return Nothing(); } @@ -292,6 +317,26 @@ bool UniFFICallSync(const GlobalObject& aGlobal, uint64_t aId, const Sequence, ScaffoldingConverter>; + CallHandler::CallSync(uniffi_remote_settings_fn_constructor_remotesettings_new, aGlobal, aArgs, aReturnValue, "uniffi_remote_settings_fn_constructor_remotesettings_new: "_ns, aError); + return true; + } + case 24: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records + using CallHandler = ScaffoldingCallHandler, 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 25: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since + using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter>; + 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 26: { // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path + using CallHandler = ScaffoldingCallHandler, ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>, ScaffoldingConverter, ScaffoldingConverter>; + 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; + } } return false; } @@ -311,6 +356,10 @@ Maybe> UniFFIReadPointer(const GlobalObject& aGl type = &kSuggestSuggestStorePointerType; break; } + case 3: { // remote_settings:RemoteSettings + type = &kRemoteSettingsRemoteSettingsPointerType; + break; + } default: return Nothing(); } @@ -332,6 +381,10 @@ bool UniFFIWritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIP type = &kSuggestSuggestStorePointerType; break; } + case 3: { // remote_settings:RemoteSettings + type = &kRemoteSettingsRemoteSettingsPointerType; + break; + } default: return false; }