{"id":25613570,"url":"https://github.com/sajjon/lemon-merringue-pie","last_synced_at":"2025-07-08T06:07:02.398Z","repository":{"id":240427131,"uuid":"802601175","full_name":"Sajjon/lemon-merringue-pie","owner":"Sajjon","description":"UniFFI workspace demo project - sharing UniFFI types between a non trivial hierarchy of crates.","archived":false,"fork":false,"pushed_at":"2024-06-14T18:21:07.000Z","size":116,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T01:36:08.090Z","etag":null,"topics":["rust","uniffi","uniffi-rs","workspace"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sajjon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-18T18:48:24.000Z","updated_at":"2024-06-14T11:54:33.000Z","dependencies_parsed_at":"2024-05-19T19:45:24.464Z","dependency_job_id":"27f0d8f8-1b9f-4866-a5dd-5a6f48794c0b","html_url":"https://github.com/Sajjon/lemon-merringue-pie","commit_stats":null,"previous_names":["sajjon/multi_crate_unifii","sajjon/multi_crate_uniffi","sajjon/lemon-merringue-pie"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Sajjon/lemon-merringue-pie","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sajjon%2Flemon-merringue-pie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sajjon%2Flemon-merringue-pie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sajjon%2Flemon-merringue-pie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sajjon%2Flemon-merringue-pie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sajjon","download_url":"https://codeload.github.com/Sajjon/lemon-merringue-pie/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sajjon%2Flemon-merringue-pie/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264207141,"owners_count":23572736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","uniffi","uniffi-rs","workspace"],"created_at":"2025-02-22T01:36:09.162Z","updated_at":"2025-07-08T06:07:02.221Z","avatar_url":"https://github.com/Sajjon.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lemon Meringue Pie\n\nApart from being [a delicious pie][pie], Lemon Meringue Pie is small demo project of [UniFFI][uf] with Cargo Workspace setup - many creates all using UniFFI that have inter-dependencies on each other.\n\n\u003e [!NOTE]\n\u003e In its current form, note that this project does NOT make use of any `ExternalExport` **contrary** to what the [external type UniFFI guide says we must do][ext]. Maybe the guide is outdated? It's of course a good thing that we don't need to state external types in the .udl files, but surprising it works without.\n\n# Cargo tree\n\nRan `cargo tree --prune uniffi --no-dedupe --package lemon_meringue_pie --format \"{lib}\"` and then removed \"[build-dependencies]\" (what is the grep/sed pipe oneliner I'm missing here? :)) yields this tree\"\n\n```sh\nlemon_meringue_pie\n├── chef\n│   └── money\n├── farm\n│   └── money\n├── kitchen\n│   └── farm\n│       └── money\n├── lemon_filling\n│   ├── farm\n│   │   └── money\n│   └── kitchen\n│       └── farm\n│           └── money\n├── meringue\n│   ├── farm\n│   │   └── money\n│   └── kitchen\n│       └── farm\n│           └── money\n├── money\n└── pastry\n    ├── farm\n    │   └── money\n    └── kitchen\n        └── farm\n            └── money\n```\n\n# Setup Kotlin\n\n```sh\nbrew install kotlin\n```\n\n## Kotlin dependencies\n\n\u003e [!IMPORTANT]  \n\u003e To run tests in Kotlin you also need to download\n\u003e [JNA](https://mvnrepository.com/artifact/net.java.dev.jna/jna)\n\u003e\n\u003e ```sh\n\u003e curl https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.14.0/jna-5.14.0.jar --output jna-5.14.0.jar\n\u003e ```\n\n## `direnv`\n\nInstall [`direnv`](https://direnv.net/) in order to automatically load `CLASSPATH` and `JAVA_OPTS` in [`.envrc`](.envrc), so that you can run Kotlin bindgen tests from cli using the command in the bottom of this document - i.e. without having to export `CLASSPATH``.\n\n# Test\n\n## Rust\n\n```rust\n#[test]\nfn bake() {\n    let chef = Chef::new(\"Auguste Gusteau\".to_owned(), Money::from(50));\n    let farm = Farm::new(Money::from(200));\n    let produce = farm.clone().produce();\n    let kitchen = kitchen_stock_with(produce);\n    let pie = bake_lemon_meringue_pie(chef.clone(), kitchen);\n    assert_eq!(chef.clone().balance(), 50);\n    assert_eq!(farm.clone().balance(), 200);\n    chef_sell_pie_to_farm(chef.clone(), pie, farm.clone(), 25);\n    assert_eq!(chef.clone().balance(), 75);\n    assert_eq!(farm.clone().balance(), 175);\n}\n```\n\n## Swift\n\n```swift\nfunc test() {\n  let chef = Chef(name: \"Auguste Gusteau\", money: Money(amount: 50))\n  let farm = Farm(money: Money(amount: 200))\n  let produce = farm.produce()\n  let kitchen = kitchenStockWith(produce: produce)\n  let pie = bakeLemonMeringuePie(chef: chef, kitchen: kitchen)\n\n  assert(chef.balance() == 50)\n  assert(farm.balance() == 200)\n\n  chefSellPieToFarm(chef: chef, pie: pie, farm: farm, price: 25)\n\n  assert(chef.balance() == 75)\n  assert(farm.balance() == 175)\n}\n\ntest()\n```\n\n## Kotlin\n\nFor Kotlin we have to import all packages\n\n```kotlin\nimport com.sajjon.lemon.meringue.pie.*\nimport com.sajjon.chef.*\nimport com.sajjon.money.*\nimport com.sajjon.farm.*\nimport com.sajjon.pastry.*\nimport com.sajjon.meringue.*\nimport com.sajjon.lemon.filling.*\nimport com.sajjon.kitchen.*\n\nfun test() {\n    val chef = Chef(name = \"Auguste Gusteau\", money = Money(amount = 50u))\n    val farm = Farm(money = Money(amount = 200u))\n    val produce = farm.produce()\n    val kitchen = kitchenStockWith(produce = produce)\n    val pie = bakeLemonMeringuePie(chef = chef, kitchen = kitchen)\n\n    assert(chef.balance() == 50.toULong())\n    assert(farm.balance() == 200.toULong())\n\n    chefSellPieToFarm(chef = chef, pie = pie, farm = farm, price = 25u)\n\n    assert(chef.balance() == 75.toULong())\n    assert(farm.balance() == 175.toULong())\n}\n\ntest()\n```\n\n[uf]: https://github.com/mozilla/uniffi-rs\n[ext]: https://mozilla.github.io/uniffi-rs/udl/ext_types_external.html\n[pie]: https://www.bbc.co.uk/food/recipes/marys_lemon_meringue_pie_02330\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajjon%2Flemon-merringue-pie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsajjon%2Flemon-merringue-pie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajjon%2Flemon-merringue-pie/lists"}