From d25da35e54bae776fbbe91e6a16b8d9ba2caadb4 Mon Sep 17 00:00:00 2001 From: jhugman Date: Wed, 16 Oct 2024 13:03:10 +0100 Subject: [PATCH] Documentation III (#125) Partially fixes #121 This PR completes the baseline documentation (I think). It adds: - internals - sketching: - the codegen'd path that the `generate turbo-modules` uses - the lifting and lowering path that the generated bindings uses - callback interfaces and async-callbacks - contribution guide for documentation. - miscellaneous typo fixes and refactoring --------- Co-authored-by: Johannes Marbach --- README.md | 25 +++- docs/src/SUMMARY.md | 19 ++- docs/src/contributing/documentation.md | 58 ++++++++++ docs/src/contributing/local-development.md | 2 +- .../guide.md => guides/getting-started.md} | 14 ++- .../pre-installation.md | 0 docs/src/guides/publishing.md | 49 ++++++++ docs/src/idioms/async-callbacks.md | 48 ++++++++ docs/src/idioms/callback-interfaces.md | 108 ++++++++++++++++++ docs/src/idioms/callbacks.md | 1 - docs/src/idioms/enums.md | 2 +- docs/src/idioms/promises.md | 66 +++++++---- docs/src/internals/lifting-and-lowering.md | 46 ++++++++ docs/src/internals/rn-codegen.md | 19 +++ scripts/run-bootstrap-docs.sh | 6 + 15 files changed, 429 insertions(+), 34 deletions(-) create mode 100644 docs/src/contributing/documentation.md rename docs/src/{getting-started/guide.md => guides/getting-started.md} (96%) rename docs/src/{getting-started => guides}/pre-installation.md (100%) create mode 100644 docs/src/guides/publishing.md create mode 100644 docs/src/idioms/callback-interfaces.md delete mode 100644 docs/src/idioms/callbacks.md create mode 100644 docs/src/internals/lifting-and-lowering.md create mode 100644 docs/src/internals/rn-codegen.md create mode 100755 scripts/run-bootstrap-docs.sh diff --git a/README.md b/README.md index a54c9a0b..6eb2acd8 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,34 @@ If you're ready to start, then start with [a step-by-step tutorial to make a Rus If you're new to uniFFI, then [**the UniFFI user guide**](https://mozilla.github.io/uniffi-rs/latest/) or [**the UniFFI examples**](https://github.com/mozilla/uniffi-rs/tree/main/examples#example-uniffi-components) are interesting places to start. +## Why `uniffi-bindgen-react-native`? + +- Spend more time writing Typescript and Rust +- Full compatibility with `uniffi-rs` +- Your Rust SDK is portable across multiple languages. + +### Why not, say WASM, via `wasm-bindgen`? + +WASM is an amazing virtual machine however: + +- your Rust crate must make alternative arrangements if it needs things that the virtual machine does not offer: + - threads and + - file access. +- you need to maintain a separate FFI (this is a temporary issue, solvable by something like uniFFI). + +## Who is using `uniffi-bindgen-react-native`? + +- [@unomed/react-native-matrix-sdk](https://www.npmjs.com/package/@unomed/react-native-matrix-sdk) + +## Prior art and related projects + +- [cawfree/react-native-webassembly](https://github.com/cawfree/react-native-webassembly) + ## Contributing If this tool sounds interesting to you, please help us develop it! You can: -* View the [contributor guidelines](./docs/contributing.md). +* View the [contributor guidelines](https://jhugman.github.io/uniffi-bindgen-react-native/). * File or work on [issues](https://github.com/jhugman/uniffi-bindgen-react-native/issues) here in GitHub.