Bug 1915642 - C++ intermediate representation, r=markh

Use an intermediate representation for the C++ codegen.  This means
converting types from `uniffi::interface` into something that can be
directly rendered in the templates.  "Intermediate representation" is
maybe too fancy of a term, but I like the compiler metaphor.

See the bug description for the theory behind this.  I like the
difference when seeing it in practice.  The template code definitely
gets simpler.

Also, start using the `Component` type, which combines a
`ComponentInterface` and `Config`, rather than always using a tuple.

Differential Revision: https://phabricator.services.mozilla.com/D220634
This commit is contained in:
Ben Dean-Kawamura
2024-09-10 17:44:05 +00:00
parent 57c36abd75
commit e3caa3bae4
18 changed files with 1178 additions and 1234 deletions

View File

@@ -332,7 +332,7 @@ export class RelevancyStore {
throw e;
}
return UniFFIScaffolding.callSync(
1, // relevancy:uniffi_relevancy_fn_constructor_relevancystore_new
5, // relevancy:uniffi_relevancy_fn_constructor_relevancystore_new
FfiConverterString.lower(dbpath),
)
}
@@ -343,7 +343,7 @@ export class RelevancyStore {
const liftError = (data) => FfiConverterTypeRelevancyApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
2, // relevancy:uniffi_relevancy_fn_method_relevancystore_calculate_metrics
0, // relevancy:uniffi_relevancy_fn_method_relevancystore_calculate_metrics
FfiConverterTypeRelevancyStore.lower(this),
)
}
@@ -359,7 +359,7 @@ export class RelevancyStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
3, // relevancy:uniffi_relevancy_fn_method_relevancystore_close
1, // relevancy:uniffi_relevancy_fn_method_relevancystore_close
FfiConverterTypeRelevancyStore.lower(this),
)
}
@@ -379,7 +379,7 @@ export class RelevancyStore {
throw e;
}
return UniFFIScaffolding.callAsync(
4, // relevancy:uniffi_relevancy_fn_method_relevancystore_ingest
2, // relevancy:uniffi_relevancy_fn_method_relevancystore_ingest
FfiConverterTypeRelevancyStore.lower(this),
FfiConverterSequencestring.lower(topUrls),
)
@@ -396,7 +396,7 @@ export class RelevancyStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
5, // relevancy:uniffi_relevancy_fn_method_relevancystore_interrupt
3, // relevancy:uniffi_relevancy_fn_method_relevancystore_interrupt
FfiConverterTypeRelevancyStore.lower(this),
)
}
@@ -408,7 +408,7 @@ export class RelevancyStore {
const liftError = (data) => FfiConverterTypeRelevancyApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
6, // relevancy:uniffi_relevancy_fn_method_relevancystore_user_interest_vector
4, // relevancy:uniffi_relevancy_fn_method_relevancystore_user_interest_vector
FfiConverterTypeRelevancyStore.lower(this),
)
}

View File

@@ -355,7 +355,7 @@ export class RemoteSettings {
throw e;
}
return UniFFIScaffolding.callSync(
8, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
9, // remote_settings:uniffi_remote_settings_fn_constructor_remotesettings_new
FfiConverterTypeRemoteSettingsConfig.lower(remoteSettingsConfig),
)
}
@@ -382,7 +382,7 @@ export class RemoteSettings {
throw e;
}
return UniFFIScaffolding.callAsync(
9, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
6, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_download_attachment_to_path
FfiConverterTypeRemoteSettings.lower(this),
FfiConverterString.lower(attachmentId),
FfiConverterString.lower(path),
@@ -400,7 +400,7 @@ export class RemoteSettings {
const liftError = (data) => FfiConverterTypeRemoteSettingsError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
10, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
7, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records
FfiConverterTypeRemoteSettings.lower(this),
)
}
@@ -424,7 +424,7 @@ export class RemoteSettings {
throw e;
}
return UniFFIScaffolding.callAsync(
11, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
8, // remote_settings:uniffi_remote_settings_fn_method_remotesettings_get_records_since
FfiConverterTypeRemoteSettings.lower(this),
FfiConverterU64.lower(timestamp),
)

View File

@@ -483,7 +483,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callSync(
13, // suggest:uniffi_suggest_fn_constructor_suggeststore_new
20, // suggest:uniffi_suggest_fn_constructor_suggeststore_new
FfiConverterString.lower(path),
FfiConverterOptionalTypeRemoteSettingsConfig.lower(settingsConfig),
)
@@ -495,7 +495,7 @@ export class SuggestStore {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
14, // suggest:uniffi_suggest_fn_method_suggeststore_clear
11, // suggest:uniffi_suggest_fn_method_suggeststore_clear
FfiConverterTypeSuggestStore.lower(this),
)
}
@@ -511,7 +511,7 @@ export class SuggestStore {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
15, // suggest:uniffi_suggest_fn_method_suggeststore_clear_dismissed_suggestions
12, // suggest:uniffi_suggest_fn_method_suggeststore_clear_dismissed_suggestions
FfiConverterTypeSuggestStore.lower(this),
)
}
@@ -535,7 +535,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
16, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_suggestion
13, // suggest:uniffi_suggest_fn_method_suggeststore_dismiss_suggestion
FfiConverterTypeSuggestStore.lower(this),
FfiConverterString.lower(rawSuggestionUrl),
)
@@ -552,7 +552,7 @@ export class SuggestStore {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
17, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
14, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_global_config
FfiConverterTypeSuggestStore.lower(this),
)
}
@@ -576,7 +576,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
18, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
15, // suggest:uniffi_suggest_fn_method_suggeststore_fetch_provider_config
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestionProvider.lower(provider),
)
@@ -601,7 +601,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
19, // suggest:uniffi_suggest_fn_method_suggeststore_ingest
16, // suggest:uniffi_suggest_fn_method_suggeststore_ingest
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestIngestionConstraints.lower(constraints),
)
@@ -626,7 +626,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callSync(
20, // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
17, // suggest:uniffi_suggest_fn_method_suggeststore_interrupt
FfiConverterTypeSuggestStore.lower(this),
FfiConverterOptionalTypeInterruptKind.lower(kind),
)
@@ -647,7 +647,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
21, // suggest:uniffi_suggest_fn_method_suggeststore_query
18, // suggest:uniffi_suggest_fn_method_suggeststore_query
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestionQuery.lower(query),
)
@@ -672,7 +672,7 @@ export class SuggestStore {
throw e;
}
return UniFFIScaffolding.callAsync(
22, // suggest:uniffi_suggest_fn_method_suggeststore_query_with_metrics
19, // suggest:uniffi_suggest_fn_method_suggeststore_query_with_metrics
FfiConverterTypeSuggestStore.lower(this),
FfiConverterTypeSuggestionQuery.lower(query),
)
@@ -738,7 +738,7 @@ export class SuggestStoreBuilder {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
24, // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
27, // suggest:uniffi_suggest_fn_constructor_suggeststorebuilder_new
)
}
return handleRustResult(functionCall(), liftResult, liftError);}
@@ -748,7 +748,7 @@ export class SuggestStoreBuilder {
const liftError = (data) => FfiConverterTypeSuggestApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callSync(
25, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
21, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_build
FfiConverterTypeSuggestStoreBuilder.lower(this),
)
}
@@ -768,7 +768,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callAsync(
26, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
22, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_cache_path
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterString.lower(path),
)
@@ -793,7 +793,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callSync(
27, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
23, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_data_path
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterString.lower(path),
)
@@ -822,7 +822,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callSync(
28, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension
24, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_load_extension
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterString.lower(libraryName),
FfiConverterOptionalstring.lower(entrypoint),
@@ -844,7 +844,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callSync(
29, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
25, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_bucket_name
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterString.lower(bucketName),
)
@@ -865,7 +865,7 @@ export class SuggestStoreBuilder {
throw e;
}
return UniFFIScaffolding.callSync(
30, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
26, // suggest:uniffi_suggest_fn_method_suggeststorebuilder_remote_settings_server
FfiConverterTypeSuggestStoreBuilder.lower(this),
FfiConverterTypeRemoteSettingsServer.lower(server),
)
@@ -2809,7 +2809,7 @@ export function rawSuggestionUrlMatches(rawUrl,url) {
throw e;
}
return UniFFIScaffolding.callSync(
31, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
10, // suggest:uniffi_suggest_fn_func_raw_suggestion_url_matches
FfiConverterString.lower(rawUrl),
FfiConverterString.lower(url),
)

View File

@@ -396,7 +396,7 @@ export class RemoteCommandStore {
throw e;
}
return UniFFIScaffolding.callAsync(
33, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
28, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command
FfiConverterTypeRemoteCommandStore.lower(this),
FfiConverterString.lower(deviceId),
FfiConverterTypeRemoteCommand.lower(command),
@@ -438,7 +438,7 @@ export class RemoteCommandStore {
throw e;
}
return UniFFIScaffolding.callAsync(
34, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
29, // tabs:uniffi_tabs_fn_method_remotecommandstore_add_remote_command_at
FfiConverterTypeRemoteCommandStore.lower(this),
FfiConverterString.lower(deviceId),
FfiConverterTypeRemoteCommand.lower(command),
@@ -457,7 +457,7 @@ export class RemoteCommandStore {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
35, // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
30, // tabs:uniffi_tabs_fn_method_remotecommandstore_get_unsent_commands
FfiConverterTypeRemoteCommandStore.lower(this),
)
}
@@ -489,7 +489,7 @@ export class RemoteCommandStore {
throw e;
}
return UniFFIScaffolding.callAsync(
36, // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
31, // tabs:uniffi_tabs_fn_method_remotecommandstore_remove_remote_command
FfiConverterTypeRemoteCommandStore.lower(this),
FfiConverterString.lower(deviceId),
FfiConverterTypeRemoteCommand.lower(command),
@@ -515,7 +515,7 @@ export class RemoteCommandStore {
throw e;
}
return UniFFIScaffolding.callAsync(
37, // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
32, // tabs:uniffi_tabs_fn_method_remotecommandstore_set_pending_command_sent
FfiConverterTypeRemoteCommandStore.lower(this),
FfiConverterTypePendingCommand.lower(command),
)
@@ -577,7 +577,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
39, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
33, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_apply
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -601,7 +601,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
40, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
34, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_ensure_current_sync_id
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterString.lower(newSyncId),
)
@@ -618,7 +618,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
41, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
35, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_last_sync
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -642,7 +642,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
42, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
36, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_prepare_for_sync
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterString.lower(clientData),
)
@@ -659,7 +659,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
43, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
37, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -675,7 +675,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
44, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
38, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_reset_sync_id
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -699,7 +699,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
45, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
39, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_last_sync
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterI64.lower(lastSync),
)
@@ -732,7 +732,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
46, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
40, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_set_uploaded
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterI64.lower(newTimestamp),
FfiConverterSequenceTypeTabsGuid.lower(uploadedIds),
@@ -758,7 +758,7 @@ export class TabsBridgedEngine {
throw e;
}
return UniFFIScaffolding.callAsync(
47, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
41, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_store_incoming
FfiConverterTypeTabsBridgedEngine.lower(this),
FfiConverterSequencestring.lower(incomingEnvelopesAsJson),
)
@@ -775,7 +775,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
48, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
42, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_finished
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -791,7 +791,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
49, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
43, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_id
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -807,7 +807,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
50, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
44, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_sync_started
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -823,7 +823,7 @@ export class TabsBridgedEngine {
const liftError = (data) => FfiConverterTypeTabsApiError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
51, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
45, // tabs:uniffi_tabs_fn_method_tabsbridgedengine_wipe
FfiConverterTypeTabsBridgedEngine.lower(this),
)
}
@@ -897,7 +897,7 @@ export class TabsStore {
throw e;
}
return UniFFIScaffolding.callAsync(
53, // tabs:uniffi_tabs_fn_constructor_tabsstore_new
51, // tabs:uniffi_tabs_fn_constructor_tabsstore_new
FfiConverterString.lower(path),
)
}
@@ -912,7 +912,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
54, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
46, // tabs:uniffi_tabs_fn_method_tabsstore_bridged_engine
FfiConverterTypeTabsStore.lower(this),
)
}
@@ -928,7 +928,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
55, // tabs:uniffi_tabs_fn_method_tabsstore_get_all
47, // tabs:uniffi_tabs_fn_method_tabsstore_get_all
FfiConverterTypeTabsStore.lower(this),
)
}
@@ -944,7 +944,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
56, // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
48, // tabs:uniffi_tabs_fn_method_tabsstore_new_remote_command_store
FfiConverterTypeTabsStore.lower(this),
)
}
@@ -960,7 +960,7 @@ export class TabsStore {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
57, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
49, // tabs:uniffi_tabs_fn_method_tabsstore_register_with_sync_manager
FfiConverterTypeTabsStore.lower(this),
)
}
@@ -984,7 +984,7 @@ export class TabsStore {
throw e;
}
return UniFFIScaffolding.callAsync(
58, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
50, // tabs:uniffi_tabs_fn_method_tabsstore_set_local_tabs
FfiConverterTypeTabsStore.lower(this),
FfiConverterSequenceTypeRemoteTabRecord.lower(remoteTabs),
)

View File

@@ -376,7 +376,7 @@ export function add(a,b) {
throw e;
}
return UniFFIScaffolding.callAsync(
59, // arithmetic:uniffi_arithmetical_fn_func_add
52, // arithmetic:uniffi_arithmetical_fn_func_add
FfiConverterU64.lower(a),
FfiConverterU64.lower(b),
)
@@ -410,7 +410,7 @@ export function div(dividend,divisor) {
throw e;
}
return UniFFIScaffolding.callAsync(
60, // arithmetic:uniffi_arithmetical_fn_func_div
53, // arithmetic:uniffi_arithmetical_fn_func_div
FfiConverterU64.lower(dividend),
FfiConverterU64.lower(divisor),
)
@@ -444,7 +444,7 @@ export function equal(a,b) {
throw e;
}
return UniFFIScaffolding.callAsync(
61, // arithmetic:uniffi_arithmetical_fn_func_equal
54, // arithmetic:uniffi_arithmetical_fn_func_equal
FfiConverterU64.lower(a),
FfiConverterU64.lower(b),
)
@@ -478,7 +478,7 @@ export function sub(a,b) {
throw e;
}
return UniFFIScaffolding.callAsync(
62, // arithmetic:uniffi_arithmetical_fn_func_sub
55, // arithmetic:uniffi_arithmetical_fn_func_sub
FfiConverterU64.lower(a),
FfiConverterU64.lower(b),
)

View File

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

View File

@@ -380,7 +380,7 @@ export function gradient(value) {
throw e;
}
return UniFFIScaffolding.callAsync(
64, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient
57, // external_types:uniffi_uniffi_fixture_external_types_fn_func_gradient
FfiConverterOptionalTypeLine.lower(value),
)
}
@@ -413,7 +413,7 @@ export function intersection(ln1,ln2) {
throw e;
}
return UniFFIScaffolding.callAsync(
65, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection
58, // external_types:uniffi_uniffi_fixture_external_types_fn_func_intersection
FfiConverterTypeLine.lower(ln1),
FfiConverterTypeLine.lower(ln2),
)

View File

@@ -473,7 +473,7 @@ export function gradient(ln) {
throw e;
}
return UniFFIScaffolding.callAsync(
70, // geometry:uniffi_uniffi_geometry_fn_func_gradient
62, // geometry:uniffi_uniffi_geometry_fn_func_gradient
FfiConverterTypeLine.lower(ln),
)
}
@@ -506,7 +506,7 @@ export function intersection(ln1,ln2) {
throw e;
}
return UniFFIScaffolding.callAsync(
71, // geometry:uniffi_uniffi_geometry_fn_func_intersection
63, // geometry:uniffi_uniffi_geometry_fn_func_intersection
FfiConverterTypeLine.lower(ln1),
FfiConverterTypeLine.lower(ln2),
)

View File

@@ -320,7 +320,7 @@ export class SingletonObject {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
67, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method
61, // refcounts:uniffi_uniffi_fixture_refcounts_fn_method_singletonobject_method
FfiConverterTypeSingletonObject.lower(this),
)
}
@@ -368,7 +368,7 @@ export function getJsRefcount() {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
68, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount
59, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_js_refcount
)
}
return handleRustResult(functionCall(), liftResult, liftError);
@@ -380,7 +380,7 @@ export function getSingleton() {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callSync(
69, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton
60, // refcounts:uniffi_uniffi_fixture_refcounts_fn_func_get_singleton
)
}
return handleRustResult(functionCall(), liftResult, liftError);

View File

@@ -619,7 +619,7 @@ export class Optionneur {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
73, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new
94, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_optionneur_new
)
}
try {
@@ -641,7 +641,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean
69, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_boolean
FfiConverterTypeOptionneur.lower(this),
FfiConverterBool.lower(value),
)
@@ -666,7 +666,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum
70, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_enum
FfiConverterTypeOptionneur.lower(this),
FfiConverterTypeEnumeration.lower(value),
)
@@ -691,7 +691,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
76, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32
71, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f32
FfiConverterTypeOptionneur.lower(this),
FfiConverterF32.lower(value),
)
@@ -716,7 +716,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64
72, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_f64
FfiConverterTypeOptionneur.lower(this),
FfiConverterF64.lower(value),
)
@@ -741,7 +741,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec
73, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI16.lower(value),
)
@@ -766,7 +766,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex
74, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i16_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI16.lower(value),
)
@@ -791,7 +791,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec
75, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI32.lower(value),
)
@@ -816,7 +816,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex
76, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i32_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI32.lower(value),
)
@@ -841,7 +841,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec
77, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI64.lower(value),
)
@@ -866,7 +866,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex
78, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i64_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI64.lower(value),
)
@@ -891,7 +891,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec
79, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterI8.lower(value),
)
@@ -916,7 +916,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex
80, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_i8_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterI8.lower(value),
)
@@ -941,7 +941,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null
81, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_null
FfiConverterTypeOptionneur.lower(this),
FfiConverterOptionalstring.lower(value),
)
@@ -966,7 +966,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence
82, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_sequence
FfiConverterTypeOptionneur.lower(this),
FfiConverterSequencestring.lower(value),
)
@@ -991,7 +991,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
88, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string
83, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_string
FfiConverterTypeOptionneur.lower(this),
FfiConverterString.lower(value),
)
@@ -1016,7 +1016,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec
84, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU16.lower(value),
)
@@ -1041,7 +1041,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex
85, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u16_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU16.lower(value),
)
@@ -1066,7 +1066,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec
86, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU32.lower(value),
)
@@ -1091,7 +1091,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
92, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex
87, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU32.lower(value),
)
@@ -1116,7 +1116,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct
88, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u32_oct
FfiConverterTypeOptionneur.lower(this),
FfiConverterU32.lower(value),
)
@@ -1141,7 +1141,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
94, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec
89, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU64.lower(value),
)
@@ -1166,7 +1166,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex
90, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u64_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU64.lower(value),
)
@@ -1191,7 +1191,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec
91, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_dec
FfiConverterTypeOptionneur.lower(this),
FfiConverterU8.lower(value),
)
@@ -1216,7 +1216,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex
92, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_u8_hex
FfiConverterTypeOptionneur.lower(this),
FfiConverterU8.lower(value),
)
@@ -1241,7 +1241,7 @@ export class Optionneur {
throw e;
}
return UniFFIScaffolding.callAsync(
98, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero
93, // rondpoint:uniffi_uniffi_rondpoint_fn_method_optionneur_sinon_zero
FfiConverterTypeOptionneur.lower(this),
FfiConverterOptionali32.lower(value),
)
@@ -1308,7 +1308,7 @@ export class Retourneur {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
100, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new
110, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_retourneur_new
)
}
try {
@@ -1330,7 +1330,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean
95, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_boolean
FfiConverterTypeRetourneur.lower(this),
FfiConverterBool.lower(value),
)
@@ -1355,7 +1355,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double
96, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_double
FfiConverterTypeRetourneur.lower(this),
FfiConverterF64.lower(value),
)
@@ -1380,7 +1380,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float
97, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_float
FfiConverterTypeRetourneur.lower(this),
FfiConverterF32.lower(value),
)
@@ -1405,7 +1405,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16
98, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i16
FfiConverterTypeRetourneur.lower(this),
FfiConverterI16.lower(value),
)
@@ -1430,7 +1430,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
105, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32
99, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i32
FfiConverterTypeRetourneur.lower(this),
FfiConverterI32.lower(value),
)
@@ -1455,7 +1455,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
106, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64
100, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i64
FfiConverterTypeRetourneur.lower(this),
FfiConverterI64.lower(value),
)
@@ -1480,7 +1480,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
107, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8
101, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_i8
FfiConverterTypeRetourneur.lower(this),
FfiConverterI8.lower(value),
)
@@ -1505,7 +1505,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
108, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres
102, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres
FfiConverterTypeRetourneur.lower(this),
FfiConverterTypeDictionnaireNombres.lower(value),
)
@@ -1530,7 +1530,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
109, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes
103, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_nombres_signes
FfiConverterTypeRetourneur.lower(this),
FfiConverterTypeDictionnaireNombresSignes.lower(value),
)
@@ -1555,7 +1555,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
110, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire
104, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_optionneur_dictionnaire
FfiConverterTypeRetourneur.lower(this),
FfiConverterTypeOptionneurDictionnaire.lower(value),
)
@@ -1580,7 +1580,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
111, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string
105, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_string
FfiConverterTypeRetourneur.lower(this),
FfiConverterString.lower(value),
)
@@ -1605,7 +1605,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
112, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16
106, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u16
FfiConverterTypeRetourneur.lower(this),
FfiConverterU16.lower(value),
)
@@ -1630,7 +1630,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
113, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32
107, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u32
FfiConverterTypeRetourneur.lower(this),
FfiConverterU32.lower(value),
)
@@ -1655,7 +1655,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
114, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64
108, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u64
FfiConverterTypeRetourneur.lower(this),
FfiConverterU64.lower(value),
)
@@ -1680,7 +1680,7 @@ export class Retourneur {
throw e;
}
return UniFFIScaffolding.callAsync(
115, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8
109, // rondpoint:uniffi_uniffi_rondpoint_fn_method_retourneur_identique_u8
FfiConverterTypeRetourneur.lower(this),
FfiConverterU8.lower(value),
)
@@ -1747,7 +1747,7 @@ export class Stringifier {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
117, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new
123, // rondpoint:uniffi_uniffi_rondpoint_fn_constructor_stringifier_new
)
}
try {
@@ -1769,7 +1769,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
118, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean
111, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_boolean
FfiConverterTypeStringifier.lower(this),
FfiConverterBool.lower(value),
)
@@ -1794,7 +1794,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
119, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double
112, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_double
FfiConverterTypeStringifier.lower(this),
FfiConverterF64.lower(value),
)
@@ -1819,7 +1819,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
120, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float
113, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_float
FfiConverterTypeStringifier.lower(this),
FfiConverterF32.lower(value),
)
@@ -1844,7 +1844,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
121, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16
114, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i16
FfiConverterTypeStringifier.lower(this),
FfiConverterI16.lower(value),
)
@@ -1869,7 +1869,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
122, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32
115, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i32
FfiConverterTypeStringifier.lower(this),
FfiConverterI32.lower(value),
)
@@ -1894,7 +1894,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
123, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64
116, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i64
FfiConverterTypeStringifier.lower(this),
FfiConverterI64.lower(value),
)
@@ -1919,7 +1919,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
124, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8
117, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_i8
FfiConverterTypeStringifier.lower(this),
FfiConverterI8.lower(value),
)
@@ -1944,7 +1944,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
125, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16
118, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u16
FfiConverterTypeStringifier.lower(this),
FfiConverterU16.lower(value),
)
@@ -1969,7 +1969,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
126, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32
119, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u32
FfiConverterTypeStringifier.lower(this),
FfiConverterU32.lower(value),
)
@@ -1994,7 +1994,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
127, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64
120, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u64
FfiConverterTypeStringifier.lower(this),
FfiConverterU64.lower(value),
)
@@ -2019,7 +2019,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
128, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8
121, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_to_string_u8
FfiConverterTypeStringifier.lower(this),
FfiConverterU8.lower(value),
)
@@ -2044,7 +2044,7 @@ export class Stringifier {
throw e;
}
return UniFFIScaffolding.callAsync(
129, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string
122, // rondpoint:uniffi_uniffi_rondpoint_fn_method_stringifier_well_known_string
FfiConverterTypeStringifier.lower(this),
FfiConverterString.lower(value),
)
@@ -3283,7 +3283,7 @@ export function copieCarte(c) {
throw e;
}
return UniFFIScaffolding.callAsync(
130, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte
64, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_carte
FfiConverterMapStringTypeEnumerationAvecDonnees.lower(c),
)
}
@@ -3308,7 +3308,7 @@ export function copieDictionnaire(d) {
throw e;
}
return UniFFIScaffolding.callAsync(
131, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire
65, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_dictionnaire
FfiConverterTypeDictionnaire.lower(d),
)
}
@@ -3333,7 +3333,7 @@ export function copieEnumeration(e) {
throw e;
}
return UniFFIScaffolding.callAsync(
132, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration
66, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumeration
FfiConverterTypeEnumeration.lower(e),
)
}
@@ -3358,7 +3358,7 @@ export function copieEnumerations(e) {
throw e;
}
return UniFFIScaffolding.callAsync(
133, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations
67, // rondpoint:uniffi_uniffi_rondpoint_fn_func_copie_enumerations
FfiConverterSequenceTypeEnumeration.lower(e),
)
}
@@ -3383,7 +3383,7 @@ export function switcheroo(b) {
throw e;
}
return UniFFIScaffolding.callAsync(
134, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo
68, // rondpoint:uniffi_uniffi_rondpoint_fn_func_switcheroo
FfiConverterBool.lower(b),
)
}

View File

@@ -324,7 +324,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
136, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new
128, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new
FfiConverterOptionalTypePoint.lower(initialPosition),
)
}
@@ -360,7 +360,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
137, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to
129, // sprites:uniffi_uniffi_sprites_fn_constructor_sprite_new_relative_to
FfiConverterTypePoint.lower(reference),
FfiConverterTypeVector.lower(direction),
)
@@ -376,7 +376,7 @@ export class Sprite {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
138, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position
125, // sprites:uniffi_uniffi_sprites_fn_method_sprite_get_position
FfiConverterTypeSprite.lower(this),
)
}
@@ -400,7 +400,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
139, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by
126, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_by
FfiConverterTypeSprite.lower(this),
FfiConverterTypeVector.lower(direction),
)
@@ -425,7 +425,7 @@ export class Sprite {
throw e;
}
return UniFFIScaffolding.callAsync(
140, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to
127, // sprites:uniffi_uniffi_sprites_fn_method_sprite_move_to
FfiConverterTypeSprite.lower(this),
FfiConverterTypePoint.lower(position),
)
@@ -677,7 +677,7 @@ export function translate(position,direction) {
throw e;
}
return UniFFIScaffolding.callAsync(
141, // sprites:uniffi_uniffi_sprites_fn_func_translate
124, // sprites:uniffi_uniffi_sprites_fn_func_translate
FfiConverterTypePoint.lower(position),
FfiConverterTypeVector.lower(direction),
)

View File

@@ -297,7 +297,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
143, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new
144, // todolist:uniffi_uniffi_todolist_fn_constructor_todolist_new
)
}
try {
@@ -319,7 +319,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
144, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries
133, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entries
FfiConverterTypeTodoList.lower(this),
FfiConverterSequenceTypeTodoEntry.lower(entries),
)
@@ -344,7 +344,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
145, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry
134, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_entry
FfiConverterTypeTodoList.lower(this),
FfiConverterTypeTodoEntry.lower(entry),
)
@@ -369,7 +369,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
146, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item
135, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_item
FfiConverterTypeTodoList.lower(this),
FfiConverterString.lower(todo),
)
@@ -394,7 +394,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
147, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items
136, // todolist:uniffi_uniffi_todolist_fn_method_todolist_add_items
FfiConverterTypeTodoList.lower(this),
FfiConverterSequencestring.lower(items),
)
@@ -419,7 +419,7 @@ export class TodoList {
throw e;
}
return UniFFIScaffolding.callAsync(
148, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item
137, // todolist:uniffi_uniffi_todolist_fn_method_todolist_clear_item
FfiConverterTypeTodoList.lower(this),
FfiConverterString.lower(todo),
)
@@ -436,7 +436,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
149, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries
138, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_entries
FfiConverterTypeTodoList.lower(this),
)
}
@@ -452,7 +452,7 @@ export class TodoList {
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
150, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first
139, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_first
FfiConverterTypeTodoList.lower(this),
)
}
@@ -468,7 +468,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
151, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items
140, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_items
FfiConverterTypeTodoList.lower(this),
)
}
@@ -484,7 +484,7 @@ export class TodoList {
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
152, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last
141, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last
FfiConverterTypeTodoList.lower(this),
)
}
@@ -500,7 +500,7 @@ export class TodoList {
const liftError = (data) => FfiConverterTypeTodoError.lift(data);
const functionCall = () => {
return UniFFIScaffolding.callAsync(
153, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry
142, // todolist:uniffi_uniffi_todolist_fn_method_todolist_get_last_entry
FfiConverterTypeTodoList.lower(this),
)
}
@@ -516,7 +516,7 @@ export class TodoList {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
154, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default
143, // todolist:uniffi_uniffi_todolist_fn_method_todolist_make_default
FfiConverterTypeTodoList.lower(this),
)
}
@@ -879,7 +879,7 @@ export function createEntryWith(todo) {
throw e;
}
return UniFFIScaffolding.callAsync(
155, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with
130, // todolist:uniffi_uniffi_todolist_fn_func_create_entry_with
FfiConverterString.lower(todo),
)
}
@@ -896,7 +896,7 @@ export function getDefaultList() {
const liftError = null;
const functionCall = () => {
return UniFFIScaffolding.callAsync(
156, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list
131, // todolist:uniffi_uniffi_todolist_fn_func_get_default_list
)
}
try {
@@ -920,7 +920,7 @@ export function setDefaultList(list) {
throw e;
}
return UniFFIScaffolding.callAsync(
157, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list
132, // todolist:uniffi_uniffi_todolist_fn_func_set_default_list
FfiConverterTypeTodoList.lower(list),
)
}

View File

@@ -13,16 +13,16 @@
//!
//! This module manages the list of ComponentInterface and the object ids.
use crate::render::cpp::ComponentInterfaceCppExt;
use crate::{Config, ConfigMap};
use crate::render::cpp::exposed_functions;
use crate::{Component, Config, ConfigMap};
use anyhow::{bail, Context, Result};
use camino::Utf8PathBuf;
use std::collections::{BTreeSet, HashMap, HashSet};
use uniffi_bindgen::interface::{CallbackInterface, ComponentInterface, FfiFunction, Object};
pub struct ComponentUniverse {
pub components: Vec<(ComponentInterface, Config)>,
pub fixture_components: Vec<(ComponentInterface, Config)>,
pub components: Vec<Component>,
pub fixture_components: Vec<Component>,
}
impl ComponentUniverse {
@@ -63,18 +63,16 @@ impl ComponentUniverse {
Ok(())
}
pub fn iter_components(&self) -> impl Iterator<Item = &Component> {
self.components.iter().chain(self.fixture_components.iter())
}
pub fn iter_cis(&self) -> impl Iterator<Item = &ComponentInterface> {
self.components
.iter()
.chain(self.fixture_components.iter())
.map(|(ci, _)| ci)
self.iter_components().map(|component| &component.ci)
}
}
fn parse_udl_files(
config_map: &ConfigMap,
fixture: bool,
) -> Result<Vec<(ComponentInterface, Config)>> {
fn parse_udl_files(config_map: &ConfigMap, fixture: bool) -> Result<Vec<Component>> {
// Sort config entries to ensure consistent output
let mut entries: Vec<_> = config_map.iter().collect();
entries.sort_by_key(|(key, _)| *key);
@@ -82,7 +80,10 @@ fn parse_udl_files(
.into_iter()
.filter_map(|(_, config)| {
if config.fixture == fixture {
Some(parse_udl_file(&config).map(|ci| (ci, config.clone())))
Some(parse_udl_file(&config).map(|ci| Component {
ci,
config: config.clone(),
}))
} else {
None
}
@@ -108,11 +109,7 @@ impl<'a> FunctionIds<'a> {
Self {
map: cis
.iter_cis()
.flat_map(|ci| {
ci.exposed_functions()
.into_iter()
.map(move |f| (ci.namespace(), f.name()))
})
.flat_map(|ci| exposed_functions(ci).map(move |f| (ci.namespace(), f.name())))
.enumerate()
.map(|(i, (namespace, name))| ((namespace, name), i))
// Sort using BTreeSet to guarantee the IDs remain stable across runs

View File

@@ -10,7 +10,6 @@ use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::Write;
use uniffi_bindgen::ComponentInterface;
mod ci_list;
mod render;
@@ -43,6 +42,8 @@ struct CliArgs {
/// Configuration for all components, read from `uniffi.toml`
type ConfigMap = HashMap<String, Config>;
type Component = uniffi_bindgen::Component<Config>;
/// Configuration for a single Component
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Config {
@@ -75,7 +76,7 @@ fn render(out_path: Utf8PathBuf, template: impl Template) -> Result<()> {
fn render_cpp(
path: Utf8PathBuf,
prefix: &str,
components: &Vec<(ComponentInterface, Config)>,
components: &[Component],
function_ids: &FunctionIds,
object_ids: &ObjectIds,
callback_ids: &CallbackIds,
@@ -88,15 +89,15 @@ fn render_cpp(
fn render_js(
out_dir: Utf8PathBuf,
components: &Vec<(ComponentInterface, Config)>,
components: &[Component],
function_ids: &FunctionIds,
object_ids: &ObjectIds,
callback_ids: &CallbackIds,
) -> Result<()> {
for (ci, config) in components {
for c in components {
let template = JSBindingsTemplate {
ci,
config,
ci: &c.ci,
config: &c.config,
function_ids,
object_ids,
callback_ids,

View File

@@ -2,16 +2,22 @@
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 super::shared::{FunctionExt, ObjectExt};
use crate::{CallbackIds, Config, FunctionIds, ObjectIds};
//! This module generates the UniFFI C++ code that sits between the Rust scaffolding code and the
//! generated JS code. The main responsibility of the generated C++ code is to implement the
//! UniFFI WebIDL interface.
//!
//! The general strategy is to take the generalized component interface and convert it into types
//! that can be easily rendered by the UniFFIScaffolding.cpp template -- an intermediate
//! representation of sorts.
//!
//! In many cases this means converting a type from `uniffi_bindgen::interface` into another type
//! that represents the same concept, but is easier for the templates to render. In this case, the
//! new type name has `Cpp` appended to it ([FfiFunction] is converted to [FfiFunctionCpp]).
use crate::{CallbackIds, Component, FunctionIds, ObjectIds};
use askama::Template;
use extend::ext;
use heck::{ToShoutySnakeCase, ToUpperCamelCase};
use std::collections::HashSet;
use std::iter;
use uniffi_bindgen::interface::{
CallbackInterface, ComponentInterface, FfiArgument, FfiFunction, FfiType, Object,
};
use uniffi_bindgen::interface::{ComponentInterface, FfiFunction, FfiType};
#[derive(Template)]
#[template(path = "UniFFIScaffolding.cpp", escape = "none")]
@@ -23,47 +29,104 @@ pub struct CPPScaffoldingTemplate<'a> {
// - Have a hand-written stub function that always calls the first function and only calls
// the second function in if MOZ_UNIFFI_FIXTURES is defined.
prefix: &'a str,
components: &'a Vec<(ComponentInterface, Config)>,
object_ids: &'a ObjectIds<'a>,
callback_ids: &'a CallbackIds<'a>,
has_any_objects: bool,
/// Info for each scaffolding call.
ffi_functions: Vec<FfiFunctionCpp>,
pointer_types: Vec<PointerType>,
callback_interfaces: Vec<CallbackInterfaceCpp>,
scaffolding_calls: Vec<ScaffoldingCall>,
}
impl<'a> CPPScaffoldingTemplate<'a> {
pub fn new(
prefix: &'a str,
components: &'a Vec<(ComponentInterface, Config)>,
components: &'a [Component],
function_ids: &'a FunctionIds<'a>,
object_ids: &'a ObjectIds<'a>,
callback_ids: &'a CallbackIds<'a>,
) -> Self {
let has_any_objects = components
.iter()
.any(|(ci, _)| ci.object_definitions().len() > 0);
Self {
prefix,
components,
object_ids,
callback_ids,
has_any_objects,
scaffolding_calls: Self::scaffolding_calls(prefix, components, function_ids),
ffi_functions: Self::ffi_functions(components),
pointer_types: Self::pointer_types(object_ids, components),
callback_interfaces: Self::callback_interfaces(prefix, callback_ids, components),
scaffolding_calls: Self::scaffolding_calls(prefix, function_ids, components),
}
}
fn ffi_functions(components: &[Component]) -> Vec<FfiFunctionCpp> {
components
.iter()
.flat_map(|c| c.ci.iter_user_ffi_function_definitions())
.map(|ffi_func| FfiFunctionCpp {
name: ffi_func.name().to_string(),
arg_types: ffi_func
.arguments()
.iter()
.map(|a| cpp_type(&a.type_()))
.chain(["RustCallStatus*".to_owned()])
.collect(),
return_type: match ffi_func.return_type() {
Some(t) => cpp_type(t),
None => "void".to_owned(),
},
})
.collect()
}
fn pointer_types(object_ids: &ObjectIds<'_>, components: &[Component]) -> Vec<PointerType> {
components
.iter()
.flat_map(|c| {
c.ci.object_definitions()
.iter()
.map(move |obj| PointerType {
object_id: object_ids.get(&c.ci, obj),
name: pointer_type(&c.ci, obj.name()),
label: format!("{}::{}", c.ci.namespace(), obj.name()),
clone_fn: obj.ffi_object_clone().name().to_string(),
free_fn: obj.ffi_object_free().name().to_string(),
})
})
.collect()
}
fn callback_interfaces(
prefix: &str,
callback_ids: &CallbackIds<'_>,
components: &[Component],
) -> Vec<CallbackInterfaceCpp> {
components
.iter()
.flat_map(|c| {
c.ci.callback_interface_definitions()
.iter()
.map(move |cbi| CallbackInterfaceCpp {
id: callback_ids.get(&c.ci, cbi),
name: format!("{}:{}", c.ci.namespace(), cbi.name()),
handler_fn: format!(
"{prefix}CallbackHandler{}",
cbi.name().to_upper_camel_case()
),
static_var: format!(
"JS_CALLBACK_HANDLER_{}",
cbi.name().to_shouty_snake_case(),
),
init_fn: cbi.ffi_init_callback().name().to_owned(),
})
})
.collect()
}
fn scaffolding_calls(
prefix: &str,
components: &[(ComponentInterface, Config)],
function_ids: &'a FunctionIds<'a>,
components: &[Component],
) -> Vec<ScaffoldingCall> {
let mut calls: Vec<ScaffoldingCall> = components
.iter()
.flat_map(|(ci, config)| {
ci.scaffolding_call_functions(config)
.into_iter()
.map(|(ffi_func, _)| ScaffoldingCall::new(prefix, ci, ffi_func, function_ids))
.collect::<Vec<_>>()
.flat_map(|c| {
exposed_functions(&c.ci).map(move |ffi_func| {
ScaffoldingCall::new(prefix, &c.ci, ffi_func, function_ids)
})
})
.collect();
calls.sort_by_key(|c| c.function_id);
@@ -71,6 +134,28 @@ impl<'a> CPPScaffoldingTemplate<'a> {
}
}
struct FfiFunctionCpp {
name: String,
arg_types: Vec<String>,
return_type: String,
}
struct PointerType {
object_id: usize,
name: String,
label: String,
clone_fn: String,
free_fn: String,
}
struct CallbackInterfaceCpp {
id: usize,
name: String,
handler_fn: String,
static_var: String,
init_fn: String,
}
struct ScaffoldingCall {
handler_class_name: String,
function_id: usize,
@@ -95,7 +180,7 @@ impl ScaffoldingCall {
.into_iter()
.map(|a| ScaffoldingCallArgument {
var_name: format!("m{}", a.name().to_upper_camel_case()),
scaffolding_converter: ci.scaffolding_converter(&a.type_()),
scaffolding_converter: scaffolding_converter(ci, &a.type_()),
})
.collect::<Vec<_>>();
@@ -106,7 +191,7 @@ impl ScaffoldingCall {
return_type: ffi_func
.return_type()
.map(|return_type| ScaffoldingCallReturnType {
scaffolding_converter: ci.scaffolding_converter(&return_type),
scaffolding_converter: scaffolding_converter(ci, &return_type),
}),
arguments,
}
@@ -122,182 +207,56 @@ struct ScaffoldingCallArgument {
scaffolding_converter: String,
}
// Define extension traits with methods used in our template code
#[ext(name=ComponentInterfaceCppExt)]
pub impl ComponentInterface {
// C++ pointer type name. This needs to be a valid C++ type name and unique across all UDL
// files.
fn pointer_type(&self, object: &Object) -> String {
self._pointer_type(object.name())
}
fn _pointer_type(&self, name: &str) -> String {
format!(
"k{}{}PointerType",
self.namespace().to_upper_camel_case(),
name.to_upper_camel_case()
)
}
// Iterate over all functions to expose via the UniFFIScaffolding class
//
// This is basically all the user functions, except we don't expose the free methods for
// objects. Freeing is handled by the UniFFIPointer class.
//
// Note: this function should return `impl Iterator<&FfiFunction>`, but that's not currently
// allowed for traits.
fn exposed_functions(&self) -> Vec<&FfiFunction> {
let excluded: HashSet<_> = self
.object_definitions()
.iter()
.map(|o| o.ffi_object_free().name())
.chain(
self.callback_interface_definitions()
.iter()
.map(|cbi| cbi.ffi_init_callback().name()),
)
.collect();
self.iter_user_ffi_function_definitions()
.filter(move |f| !excluded.contains(f.name()))
.collect()
}
// Generate scaffolding call functions used in the interface
//
// This is used to generate the `uniffiScaffoldingCall*` classes that implement these calls.
//
// Generates both the FfiFunction and also if the function is "JS-async", i.e. should we
// generate code to dispatch the call to a worker thread.
fn scaffolding_call_functions(&self, config: &Config) -> Vec<(&FfiFunction, bool)> {
self.function_definitions()
.into_iter()
.map(|f| (f.ffi_func(), f.is_js_async(config)))
.chain(self.object_definitions().into_iter().flat_map(|o| {
o.methods()
.into_iter()
.map(|m| (m.ffi_func(), o.is_method_async(m, config)))
.chain(
o.constructors()
.into_iter()
.map(|c| (c.ffi_func(), o.is_constructor_async(config))),
)
.collect::<Vec<_>>()
}))
.collect()
}
// ScaffoldingConverter class
//
// This is used to convert types between the JS code and Rust
fn scaffolding_converter(&self, ffi_type: &FfiType) -> String {
match ffi_type {
FfiType::RustArcPtr(name) => {
format!("ScaffoldingObjectConverter<&{}>", self._pointer_type(name),)
}
_ => format!("ScaffoldingConverter<{}>", ffi_type.cpp_type()),
fn scaffolding_converter(ci: &ComponentInterface, ffi_type: &FfiType) -> String {
match ffi_type {
FfiType::RustArcPtr(name) => {
format!("ScaffoldingObjectConverter<&{}>", pointer_type(ci, name),)
}
}
// ScaffoldingCallHandler class
fn scaffolding_call_handler(&self, func: &FfiFunction) -> String {
let return_param = match func.return_type() {
Some(return_type) => self.scaffolding_converter(return_type),
None => "ScaffoldingConverter<void>".to_string(),
};
let all_params = iter::once(return_param)
.chain(
func.arguments()
.into_iter()
.map(|a| self.scaffolding_converter(&a.type_())),
)
.collect::<Vec<_>>()
.join(", ");
return format!("ScaffoldingCallHandler<{}>", all_params);
_ => format!("ScaffoldingConverter<{}>", cpp_type(ffi_type)),
}
}
#[ext(name=FFIFunctionCppExt)]
pub impl FfiFunction {
fn js_name(&self) -> String {
self.name().to_upper_camel_case()
}
fn pointer_type(ci: &ComponentInterface, name: &str) -> String {
format!(
"k{}{}PointerType",
ci.namespace().to_upper_camel_case(),
name.to_upper_camel_case()
)
}
fn cpp_name(&self) -> String {
self.name().to_string()
}
fn cpp_return_type(&self) -> String {
match self.return_type() {
Some(t) => t.cpp_type(),
None => "void".to_owned(),
}
}
fn cpp_arg_list(&self) -> String {
let mut parts: Vec<String> = self.arguments().iter().map(|a| a.cpp_type()).collect();
parts.push("RustCallStatus*".to_owned());
parts.join(", ")
// Type for the Rust scaffolding code
fn cpp_type(ffi_type: &FfiType) -> String {
match ffi_type {
FfiType::UInt8 => "uint8_t".to_owned(),
FfiType::Int8 => "int8_t".to_owned(),
FfiType::UInt16 => "uint16_t".to_owned(),
FfiType::Int16 => "int16_t".to_owned(),
FfiType::UInt32 => "uint32_t".to_owned(),
FfiType::Int32 => "int32_t".to_owned(),
FfiType::UInt64 => "uint64_t".to_owned(),
FfiType::Int64 => "int64_t".to_owned(),
FfiType::Float32 => "float".to_owned(),
FfiType::Float64 => "double".to_owned(),
FfiType::RustBuffer(_) => "RustBuffer".to_owned(),
FfiType::RustArcPtr(_) => "void*".to_owned(),
FfiType::ForeignBytes => unimplemented!("ForeignBytes not supported"),
FfiType::Handle => "uint64_t".to_owned(),
FfiType::RustCallStatus => "RustCallStatus".to_owned(),
FfiType::Callback(name) | FfiType::Struct(name) => name.to_owned(),
FfiType::VoidPointer => "void*".to_owned(),
FfiType::Reference(_) => unimplemented!("References not supported"),
}
}
#[ext(name=FFITypeCppExt)]
pub impl FfiType {
// Type for the Rust scaffolding code
fn cpp_type(&self) -> String {
match self {
FfiType::UInt8 => "uint8_t".to_owned(),
FfiType::Int8 => "int8_t".to_owned(),
FfiType::UInt16 => "uint16_t".to_owned(),
FfiType::Int16 => "int16_t".to_owned(),
FfiType::UInt32 => "uint32_t".to_owned(),
FfiType::Int32 => "int32_t".to_owned(),
FfiType::UInt64 => "uint64_t".to_owned(),
FfiType::Int64 => "int64_t".to_owned(),
FfiType::Float32 => "float".to_owned(),
FfiType::Float64 => "double".to_owned(),
FfiType::RustBuffer(_) => "RustBuffer".to_owned(),
FfiType::RustArcPtr(_) => "void*".to_owned(),
FfiType::ForeignBytes => unimplemented!("ForeignBytes not supported"),
FfiType::Handle => "uint64_t".to_owned(),
FfiType::RustCallStatus => "RustCallStatus".to_owned(),
FfiType::Callback(name) | FfiType::Struct(name) => name.to_owned(),
FfiType::VoidPointer => "void*".to_owned(),
FfiType::Reference(_) => unimplemented!("References not supported"),
}
}
}
#[ext(name=FFIArgumentCppExt)]
pub impl FfiArgument {
fn cpp_type(&self) -> String {
self.type_().cpp_type()
}
}
#[ext(name=ObjectCppExt)]
pub impl Object {
fn js_name(&self) -> String {
self.name().to_upper_camel_case()
}
}
#[ext(name=CallbackInterfaceCppExt)]
pub impl CallbackInterface {
fn js_name(&self) -> String {
self.name().to_upper_camel_case()
}
/// Name of the static pointer to the JS callback handler
fn js_handler(&self) -> String {
format!("JS_CALLBACK_HANDLER_{}", self.name().to_shouty_snake_case())
}
/// Name of the C function handler
fn c_handler(&self, prefix: &str) -> String {
format!(
"{prefix}CallbackHandler{}",
self.name().to_upper_camel_case()
)
}
/// Get scaffolding call functions exposed to JS through the `UniFFIScaffolding` WebIDL interface
pub fn exposed_functions(ci: &ComponentInterface) -> impl Iterator<Item = &FfiFunction> {
ci.function_definitions()
.into_iter()
.map(|f| f.ffi_func())
.chain(ci.object_definitions().into_iter().flat_map(|o| {
o.methods()
.into_iter()
.map(|m| m.ffi_func())
.chain(o.constructors().into_iter().map(|c| c.ffi_func()))
}))
}

View File

@@ -29,57 +29,48 @@ using dom::UniFFIScaffoldingCallResult;
// Define scaffolding functions from UniFFI
extern "C" {
{%- for (ci, config) in components %}
{%- for func in ci.iter_user_ffi_function_definitions() %}
{{ func.cpp_return_type() }} {{ func.cpp_name() }}({{ func.cpp_arg_list() }});
{%- endfor %}
{%- for func in ffi_functions %}
{{ func.return_type }} {{ func.name }}({{ func.arg_types|join(", ") }});
{%- endfor %}
}
// Define pointer types
{%- for (ci, config) in components %}
{%- for object in ci.object_definitions() %}
{%- let pointer_type = ci.pointer_type(object) %}
const static mozilla::uniffi::UniFFIPointerType {{ pointer_type }} {
"{{ "{}::{}"|format(ci.namespace(), object.name()) }}"_ns,
{{ object.ffi_object_clone().cpp_name() }},
{{ object.ffi_object_free().cpp_name() }},
{%- for pointer_type in pointer_types %}
const static mozilla::uniffi::UniFFIPointerType {{ pointer_type.name }} {
"{{ pointer_type.label }}"_ns,
{{ pointer_type.clone_fn }},
{{ pointer_type.free_fn }},
};
{%- endfor %}
{%- endfor %}
// Define the data we need per-callback interface
{%- for (ci, config) in components %}
{%- for cbi in ci.callback_interface_definitions() %}
{%- for cbi in callback_interfaces %}
MOZ_CAN_RUN_SCRIPT
extern "C" int {{ cbi.c_handler(prefix) }}(uint64_t aHandle, uint32_t aMethod, const uint8_t* aArgsData, int32_t aArgsLen, RustBuffer* aOutBuffer) {
extern "C" int {{ cbi.handler_fn }}(uint64_t aHandle, uint32_t aMethod, const uint8_t* aArgsData, int32_t aArgsLen, RustBuffer* aOutBuffer) {
// Currently, we only support "fire-and-forget" async callbacks. These are
// callbacks that run asynchronously without returning anything. The main
// use case for callbacks is logging, which fits very well with this model.
//
// So, here we simple queue the callback and return immediately.
mozilla::uniffi::QueueCallback({{ callback_ids.get(ci, cbi) }}, aHandle, aMethod, aArgsData, aArgsLen);
mozilla::uniffi::QueueCallback({{ cbi.id }}, aHandle, aMethod, aArgsData, aArgsLen);
return CALLBACK_INTERFACE_SUCCESS;
}
static StaticRefPtr<dom::UniFFICallbackHandler> {{ cbi.js_handler() }};
{%- endfor %}
static StaticRefPtr<dom::UniFFICallbackHandler> {{ cbi.static_var }};
{%- endfor %}
// Define a lookup function for our callback interface info
Maybe<CallbackInterfaceInfo> {{ prefix }}GetCallbackInterfaceInfo(uint64_t aInterfaceId) {
switch(aInterfaceId) {
{%- for (ci, config) in components %}
{%- for cbi in ci.callback_interface_definitions() %}
case {{ callback_ids.get(ci, cbi) }}: { // {{ callback_ids.name(ci, cbi) }}
{%- for cbi in callback_interfaces %}
case {{ cbi.id }}: {
return Some(CallbackInterfaceInfo {
"{{ cbi.name() }}",
&{{ cbi.js_handler() }},
{{ cbi.c_handler(prefix) }},
{{ cbi.ffi_init_callback().name() }},
"{{ cbi.name }}",
&{{ cbi.static_var }},
{{ cbi.handler_fn }},
{{ cbi.init_fn }},
});
}
{%- endfor %}
{%- endfor %}
default:
return Nothing();
@@ -169,45 +160,41 @@ UniquePtr<UniffiHandlerBase> {{ prefix }}GetHandler(uint64_t aId) {
}
Maybe<already_AddRefed<UniFFIPointer>> {{ prefix }}ReadPointer(const GlobalObject& aGlobal, uint64_t aId, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) {
{%- if has_any_objects %}
{%- if pointer_types.is_empty() %}
return Nothing();
{%- else %}
const UniFFIPointerType* type;
switch (aId) {
{%- for (ci, config) in components %}
{%- for object in ci.object_definitions() %}
case {{ object_ids.get(ci, object) }}: { // {{ object_ids.name(ci, object) }}
type = &{{ ci.pointer_type(object) }};
{%- for pointer_type in pointer_types %}
case {{ pointer_type.object_id }}: {
type = &{{ pointer_type.name }};
break;
}
{%- endfor %}
{%- endfor %}
default:
return Nothing();
}
return Some(UniFFIPointer::Read(aArrayBuff, aPosition, type, aError));
{%- else %}
return Nothing();
{%- endif %}
}
bool {{ prefix }}WritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer& aPtr, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) {
{%- if has_any_objects %}
{%- if pointer_types.is_empty() %}
return false;
{%- else %}
const UniFFIPointerType* type;
switch (aId) {
{%- for (ci, config) in components %}
{%- for object in ci.object_definitions() %}
case {{ object_ids.get(ci, object) }}: { // {{ object_ids.name(ci, object) }}
type = &{{ ci.pointer_type(object) }};
{%- for pointer_type in pointer_types %}
case {{ pointer_type.object_id }}: {
type = &{{ pointer_type.name }};
break;
}
{%- endfor %}
{%- endfor %}
default:
return false;
}
aPtr.Write(aArrayBuff, aPosition, type, aError);
return true;
{%- else %}
return false;
{%- endif %}
}

File diff suppressed because it is too large Load Diff

View File

@@ -146,46 +146,6 @@ Maybe<CallbackInterfaceInfo> UniFFIGetCallbackInterfaceInfo(uint64_t aInterfaceI
}
// Define scaffolding call classes for each combination of return/argument types
class ScaffoldingCallHandlerUniFFIUniffiRelevancyFnConstructorRelevancystoreNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mDbpath;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mDbpath, aError);
if (aError.Failed()) {
return;
}
}
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>::FromRust(
uniffi_relevancy_fn_constructor_relevancystore_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mDbpath)),
&callStatus
)
);
mUniffiCallStatusCode = callStatus.code;
if (callStatus.error_buf.data) {
mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf);
}
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
aError
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiRelevancyFnMethodRelevancystoreCalculateMetrics : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
@@ -374,17 +334,17 @@ public:
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnConstructorRemotesettingsNew : public UniffiHandlerBase {
class ScaffoldingCallHandlerUniFFIUniffiRelevancyFnConstructorRelevancystoreNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mRemoteSettingsConfig;
typename ScaffoldingConverter<RustBuffer>::IntermediateType mDbpath;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>::IntermediateType mUniffiReturnValue;
typename ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mRemoteSettingsConfig, aError);
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mDbpath, aError);
if (aError.Failed()) {
return;
}
@@ -392,9 +352,9 @@ public:
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>::FromRust(
uniffi_remote_settings_fn_constructor_remotesettings_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mRemoteSettingsConfig)),
mUniffiReturnValue = ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>::FromRust(
uniffi_relevancy_fn_constructor_relevancystore_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mDbpath)),
&callStatus
)
);
@@ -406,7 +366,7 @@ public:
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>::IntoJs(
ScaffoldingObjectConverter<&kRelevancyRelevancyStorePointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
@@ -543,22 +503,17 @@ public:
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststoreNew : public UniffiHandlerBase {
class ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnConstructorRemotesettingsNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mPath;
typename ScaffoldingConverter<RustBuffer>::IntermediateType mSettingsConfig;
typename ScaffoldingConverter<RustBuffer>::IntermediateType mRemoteSettingsConfig;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>::IntermediateType mUniffiReturnValue;
typename ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mPath, aError);
if (aError.Failed()) {
return;
}
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[1], &mSettingsConfig, aError);
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mRemoteSettingsConfig, aError);
if (aError.Failed()) {
return;
}
@@ -566,10 +521,9 @@ public:
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>::FromRust(
uniffi_suggest_fn_constructor_suggeststore_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mPath)),
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mSettingsConfig)),
mUniffiReturnValue = ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>::FromRust(
uniffi_remote_settings_fn_constructor_remotesettings_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mRemoteSettingsConfig)),
&callStatus
)
);
@@ -581,7 +535,53 @@ public:
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>::IntoJs(
ScaffoldingObjectConverter<&kRemoteSettingsRemoteSettingsPointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
aError
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiSuggestFnFuncRawSuggestionUrlMatches : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mRawUrl;
typename ScaffoldingConverter<RustBuffer>::IntermediateType mUrl;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingConverter<int8_t>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mRawUrl, aError);
if (aError.Failed()) {
return;
}
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[1], &mUrl, aError);
if (aError.Failed()) {
return;
}
}
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingConverter<int8_t>::FromRust(
uniffi_suggest_fn_func_raw_suggestion_url_matches(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mRawUrl)),
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mUrl)),
&callStatus
)
);
mUniffiCallStatusCode = callStatus.code;
if (callStatus.error_buf.data) {
mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf);
}
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingConverter<int8_t>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
@@ -949,21 +949,33 @@ public:
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststorebuilderNew : public UniffiHandlerBase {
class ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststoreNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mPath;
typename ScaffoldingConverter<RustBuffer>::IntermediateType mSettingsConfig;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>::IntermediateType mUniffiReturnValue;
typename ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mPath, aError);
if (aError.Failed()) {
return;
}
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[1], &mSettingsConfig, aError);
if (aError.Failed()) {
return;
}
}
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>::FromRust(
uniffi_suggest_fn_constructor_suggeststorebuilder_new(
mUniffiReturnValue = ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>::FromRust(
uniffi_suggest_fn_constructor_suggeststore_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mPath)),
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mSettingsConfig)),
&callStatus
)
);
@@ -975,7 +987,7 @@ public:
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>::IntoJs(
ScaffoldingObjectConverter<&kSuggestSuggestStorePointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
@@ -1259,33 +1271,21 @@ public:
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiSuggestFnFuncRawSuggestionUrlMatches : public UniffiHandlerBase {
class ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststorebuilderNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mRawUrl;
typename ScaffoldingConverter<RustBuffer>::IntermediateType mUrl;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingConverter<int8_t>::IntermediateType mUniffiReturnValue;
typename ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mRawUrl, aError);
if (aError.Failed()) {
return;
}
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[1], &mUrl, aError);
if (aError.Failed()) {
return;
}
}
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingConverter<int8_t>::FromRust(
uniffi_suggest_fn_func_raw_suggestion_url_matches(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mRawUrl)),
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mUrl)),
mUniffiReturnValue = ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>::FromRust(
uniffi_suggest_fn_constructor_suggeststorebuilder_new(
&callStatus
)
);
@@ -1297,7 +1297,7 @@ public:
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingConverter<int8_t>::IntoJs(
ScaffoldingObjectConverter<&kSuggestSuggestStoreBuilderPointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
@@ -2037,46 +2037,6 @@ public:
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
}
};
class ScaffoldingCallHandlerUniFFIUniffiTabsFnConstructorTabsstoreNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mPath;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingObjectConverter<&kTabsTabsStorePointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mPath, aError);
if (aError.Failed()) {
return;
}
}
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingObjectConverter<&kTabsTabsStorePointerType>::FromRust(
uniffi_tabs_fn_constructor_tabsstore_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mPath)),
&callStatus
)
);
mUniffiCallStatusCode = callStatus.code;
if (callStatus.error_buf.data) {
mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf);
}
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingObjectConverter<&kTabsTabsStorePointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
aError
);
}
};
class ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsstoreBridgedEngine : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
@@ -2265,165 +2225,205 @@ public:
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
}
};
class ScaffoldingCallHandlerUniFFIUniffiTabsFnConstructorTabsstoreNew : public UniffiHandlerBase {
private:
// PrepareRustArgs stores the resulting arguments in these fields
typename ScaffoldingConverter<RustBuffer>::IntermediateType mPath;
// MakeRustCall stores the result of the call in these fields
typename ScaffoldingObjectConverter<&kTabsTabsStorePointerType>::IntermediateType mUniffiReturnValue;
public:
void PrepareRustArgs(const dom::Sequence<dom::UniFFIScaffoldingValue>& aArgs, ErrorResult& aError) override {
ScaffoldingConverter<RustBuffer>::FromJs(aArgs[0], &mPath, aError);
if (aError.Failed()) {
return;
}
}
void MakeRustCall() override {
RustCallStatus callStatus{};
mUniffiReturnValue = ScaffoldingObjectConverter<&kTabsTabsStorePointerType>::FromRust(
uniffi_tabs_fn_constructor_tabsstore_new(
ScaffoldingConverter<RustBuffer>::IntoRust(std::move(mPath)),
&callStatus
)
);
mUniffiCallStatusCode = callStatus.code;
if (callStatus.error_buf.data) {
mUniffiCallStatusErrorBuf = OwnedRustBuffer(callStatus.error_buf);
}
}
virtual void ExtractSuccessfulCallResult(JSContext* aCx, dom::Optional<dom::UniFFIScaffoldingValue>& aDest, ErrorResult& aError) override {
ScaffoldingObjectConverter<&kTabsTabsStorePointerType>::IntoJs(
aCx,
std::move(mUniffiReturnValue),
aDest,
aError
);
}
};
UniquePtr<UniffiHandlerBase> UniFFIGetHandler(uint64_t aId) {
switch (aId) {
case 1: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnConstructorRelevancystoreNew>();
}
case 2: {
case 0: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnMethodRelevancystoreCalculateMetrics>();
}
case 3: {
case 1: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnMethodRelevancystoreClose>();
}
case 4: {
case 2: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnMethodRelevancystoreIngest>();
}
case 5: {
case 3: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnMethodRelevancystoreInterrupt>();
}
case 6: {
case 4: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnMethodRelevancystoreUserInterestVector>();
}
case 8: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnConstructorRemotesettingsNew>();
case 5: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRelevancyFnConstructorRelevancystoreNew>();
}
case 9: {
case 6: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnMethodRemotesettingsDownloadAttachmentToPath>();
}
case 10: {
case 7: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnMethodRemotesettingsGetRecords>();
}
case 11: {
case 8: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnMethodRemotesettingsGetRecordsSince>();
}
case 13: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststoreNew>();
case 9: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiRemoteSettingsFnConstructorRemotesettingsNew>();
}
case 14: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreClear>();
}
case 15: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreClearDismissedSuggestions>();
}
case 16: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreDismissSuggestion>();
}
case 17: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreFetchGlobalConfig>();
}
case 18: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreFetchProviderConfig>();
}
case 19: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreIngest>();
}
case 20: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreInterrupt>();
}
case 21: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreQuery>();
}
case 22: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreQueryWithMetrics>();
}
case 24: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststorebuilderNew>();
}
case 25: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderBuild>();
}
case 26: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderCachePath>();
}
case 27: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderDataPath>();
}
case 28: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderLoadExtension>();
}
case 29: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderRemoteSettingsBucketName>();
}
case 30: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderRemoteSettingsServer>();
}
case 31: {
case 10: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnFuncRawSuggestionUrlMatches>();
}
case 33: {
case 11: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreClear>();
}
case 12: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreClearDismissedSuggestions>();
}
case 13: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreDismissSuggestion>();
}
case 14: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreFetchGlobalConfig>();
}
case 15: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreFetchProviderConfig>();
}
case 16: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreIngest>();
}
case 17: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreInterrupt>();
}
case 18: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreQuery>();
}
case 19: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststoreQueryWithMetrics>();
}
case 20: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststoreNew>();
}
case 21: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderBuild>();
}
case 22: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderCachePath>();
}
case 23: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderDataPath>();
}
case 24: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderLoadExtension>();
}
case 25: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderRemoteSettingsBucketName>();
}
case 26: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnMethodSuggeststorebuilderRemoteSettingsServer>();
}
case 27: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiSuggestFnConstructorSuggeststorebuilderNew>();
}
case 28: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodRemotecommandstoreAddRemoteCommand>();
}
case 34: {
case 29: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodRemotecommandstoreAddRemoteCommandAt>();
}
case 35: {
case 30: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodRemotecommandstoreGetUnsentCommands>();
}
case 36: {
case 31: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodRemotecommandstoreRemoveRemoteCommand>();
}
case 37: {
case 32: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodRemotecommandstoreSetPendingCommandSent>();
}
case 39: {
case 33: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineApply>();
}
case 40: {
case 34: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineEnsureCurrentSyncId>();
}
case 41: {
case 35: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineLastSync>();
}
case 42: {
case 36: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedenginePrepareForSync>();
}
case 43: {
case 37: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineReset>();
}
case 44: {
case 38: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineResetSyncId>();
}
case 45: {
case 39: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineSetLastSync>();
}
case 46: {
case 40: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineSetUploaded>();
}
case 47: {
case 41: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineStoreIncoming>();
}
case 48: {
case 42: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineSyncFinished>();
}
case 49: {
case 43: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineSyncId>();
}
case 50: {
case 44: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineSyncStarted>();
}
case 51: {
case 45: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsbridgedengineWipe>();
}
case 53: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnConstructorTabsstoreNew>();
}
case 54: {
case 46: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsstoreBridgedEngine>();
}
case 55: {
case 47: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsstoreGetAll>();
}
case 56: {
case 48: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsstoreNewRemoteCommandStore>();
}
case 57: {
case 49: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsstoreRegisterWithSyncManager>();
}
case 58: {
case 50: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnMethodTabsstoreSetLocalTabs>();
}
case 51: {
return MakeUnique<ScaffoldingCallHandlerUniFFIUniffiTabsFnConstructorTabsstoreNew>();
}
default:
return nullptr;
@@ -2433,31 +2433,31 @@ UniquePtr<UniffiHandlerBase> UniFFIGetHandler(uint64_t aId) {
Maybe<already_AddRefed<UniFFIPointer>> UniFFIReadPointer(const GlobalObject& aGlobal, uint64_t aId, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) {
const UniFFIPointerType* type;
switch (aId) {
case 0: { // relevancy:RelevancyStore
case 0: {
type = &kRelevancyRelevancyStorePointerType;
break;
}
case 1: { // remote_settings:RemoteSettings
case 1: {
type = &kRemoteSettingsRemoteSettingsPointerType;
break;
}
case 2: { // suggest:SuggestStore
case 2: {
type = &kSuggestSuggestStorePointerType;
break;
}
case 3: { // suggest:SuggestStoreBuilder
case 3: {
type = &kSuggestSuggestStoreBuilderPointerType;
break;
}
case 4: { // tabs:RemoteCommandStore
case 4: {
type = &kTabsRemoteCommandStorePointerType;
break;
}
case 5: { // tabs:TabsBridgedEngine
case 5: {
type = &kTabsTabsBridgedEnginePointerType;
break;
}
case 6: { // tabs:TabsStore
case 6: {
type = &kTabsTabsStorePointerType;
break;
}
@@ -2470,31 +2470,31 @@ Maybe<already_AddRefed<UniFFIPointer>> UniFFIReadPointer(const GlobalObject& aGl
bool UniFFIWritePointer(const GlobalObject& aGlobal, uint64_t aId, const UniFFIPointer& aPtr, const ArrayBuffer& aArrayBuff, long aPosition, ErrorResult& aError) {
const UniFFIPointerType* type;
switch (aId) {
case 0: { // relevancy:RelevancyStore
case 0: {
type = &kRelevancyRelevancyStorePointerType;
break;
}
case 1: { // remote_settings:RemoteSettings
case 1: {
type = &kRemoteSettingsRemoteSettingsPointerType;
break;
}
case 2: { // suggest:SuggestStore
case 2: {
type = &kSuggestSuggestStorePointerType;
break;
}
case 3: { // suggest:SuggestStoreBuilder
case 3: {
type = &kSuggestSuggestStoreBuilderPointerType;
break;
}
case 4: { // tabs:RemoteCommandStore
case 4: {
type = &kTabsRemoteCommandStorePointerType;
break;
}
case 5: { // tabs:TabsBridgedEngine
case 5: {
type = &kTabsTabsBridgedEnginePointerType;
break;
}
case 6: { // tabs:TabsStore
case 6: {
type = &kTabsTabsStorePointerType;
break;
}