Skip to content

Instantly share code, notes, and snippets.

# This code comes from taking James' of components and composition and trying to run the other way
# with it. Instead of (maybe in addition to) creating composible components in uniffi_bindgen, what if we
# tried to write them in the target language?
#
# The basic idea would be:
# - Define a ViaFFI interface
# - Map Type enums to objects that implement the interface for that type. How this works will
# depend on the target language:
# - For python, we could setup a dict that maps the canonical type name to an object
# - For Rust, we could map the Type enum to a struct that implements the ViaFFi trait (I'm
@bendk
bendk / uniffi.toml
Last active November 29, 2021 16:21
[bindings.swift.decorators.MyInterface]
import = "my.decorator.module"
class_name = "MyDecorator"
[bindings.swift.decorators.MyInterface.methods.catchAll]
# "{}" is replaced with the decorated function's return type.
# We'd need to do a bit of normalizing, like replacing "??" with "?".
return_type = "{}?"
# true means the decorator function throws, I think false should be the default and this could just be left out.
throws = false
namespace maker {};
[Error]
enum MakerError {
"OutOfResources",
};
[Decorated=MyDecoratedInterface]
interface MyInterface {
constructor();
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-gecko-js` crate.
// Trust me, you don't want to mess with it!
[ChromeOnly, Exposed=Window]
namespace GeometryScaffolding {
[Throws]
Promise<UniFFIRustCallResult> geometryEb69Gradient(ArrayBuffer ln );
[Throws]
Promise<UniFFIRustCallResult> geometryEb69Intersection(ArrayBuffer ln1, ArrayBuffer ln2 );
};
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-gecko-js` crate.
// Trust me, you don't want to mess with it!
#ifndef mozilla_dom_GeometryScaffolding_h
#define mozilla_dom_GeometryScaffolding_h
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/RootedDictionary.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/UniFFIRustCallResultBinding.h"
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
"use strict";
var EXPORTED_SYMBOLS = [];
// UniFFIRustCallResult.code values
const CALL_SUCCESS = 0;
const CALL_ERROR = 1;
diff '--color=auto' -du v91.0.1/nimbusFFI.h v91.1.0/nimbusFFI.h
--- v91.0.1/nimbusFFI.h 2022-04-11 16:07:18.560552019 -0400
+++ v91.1.0/nimbusFFI.h 2022-04-11 16:07:07.692544443 -0400
@@ -46,87 +46,115 @@
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V4 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
-void ffi_nimbus_59ee_NimbusClient_object_free(
+void ffi_nimbus_302d_NimbusClient_object_free(
void*_Nonnull ptr,
diff --git a/components/support/nimbus-fml/fixtures/fe/fenix.yaml b/components/support/nimbus-fml/fixtures/fe/fenix.yaml
index a4fc8feb..ec313be2 100644
--- a/components/support/nimbus-fml/fixtures/fe/fenix.yaml
+++ b/components/support/nimbus-fml/fixtures/fe/fenix.yaml
@@ -47,6 +47,10 @@ features:
description: The drawable displayed in the app menu for Settings
type: Drawable
default: mozac_ic_settings
+ icon-type:
+ description: Testing an enum value
@bendk
bendk / gist:f9e664549635062b5696a2259f7d6a76
Created April 19, 2022 20:31
Output from cargo run -p nimbus-fml -- fixtures/fe/fenix.yaml android features -o /dev/stdout --r-package org.mozilla.fenix
// This file was autogenerated by some hot garbage in the `nimbus-fml` crate.
// Trust me, you don't want to mess with it!
import android.content.Context
import android.graphics.drawable.Drawable
import org.mozilla.experiments.nimbus.FeaturesInterface
import org.mozilla.experiments.nimbus.NullVariables
import org.mozilla.experiments.nimbus.Res
import org.mozilla.experiments.nimbus.StringHolder
/** Disk-Space Utilization Report For places.db
Page size in bytes................................ 32768
Pages in the whole file (measured)................ 82
Pages in the whole file (calculated).............. 82
Pages that store data............................. 82 100.0%
Pages on the freelist (per header)................ 0 0.0%
Pages on the freelist (calculated)................ 0 0.0%
Pages of auto-vacuum overhead..................... 0 0.0%
Number of tables in the database.................. 21