| Crates.io | loro-ffi |
| lib.rs | loro-ffi |
| version | 1.8.1 |
| created_at | 2025-05-20 03:05:26.744084+00 |
| updated_at | 2025-09-23 13:59:57.326886+00 |
| description | FFI bindings for Loro |
| homepage | https://loro.dev |
| repository | https://github.com/loro-dev/loro |
| max_upload_size | |
| id | 1680706 |
| size | 262,917 |
Foreign Function Interface (FFI) bindings for Loro, a high-performance CRDT library for building collaborative applications.
Loro FFI provides cross-language bindings for the Loro CRDT library, enabling developers to use Loro's powerful collaborative editing capabilities in various programming languages. Built with UniFFI, this library generates clean, idiomatic bindings for multiple target languages.
You can find the updates here
Read the UniFFI documentation and modify the uniffi.toml configuration in this repository as needed.
Add this repository as a git submodule for your bindings:
git submodule add https://github.com/loro-dev/loro-ffi.git loro-ffi
git add .gitmodules loro-ffi
Build language-specific wrapper layers around the current UniFFI binding results to provide a better developer experience, including but not limited to:
Callback Function Wrapping: Provide direct closure support for functions that require callback parameters, such as LoroDoc::subscribe(), UndoManager::set_on_push(), and EphemeralStore::subscribe().
Native Type Extensions: Implement LoroValueLike ContainerIdLike extensions for built-in types in target languages, enabling direct parameter usage:
LoroMap.insert("key", "value");
LoroMap.insert("key", 123);
LoroMap.insert("key", true);
LoroMap.insert("key", [1, 2, 3]);
// ... and more
Unified Export Interface: Create a unified entry point for LoroDoc::export:
class LoroDoc {
function export(mode: ExportMode) {
// Wraps:
// exportSnapshot()
// exportUpdates(from)
// exportUpdatesInRange(spans)
// exportShallowSnapshot(frontiers)
// exportStateOnly(frontiers)
// exportSnapshotAt(frontiers)
}
}
Unified Container Creation Interface: Provide unified entry points for creating child containers in LoroMap/LoroList/LoroMovableList:
class LoroMap {
function insertContainer(key: string, child: Container) {
// Wraps:
// insertListContainer
// insertMapContainer
// insertTextContainer
// insertTreeContainer
// insertMovableListContainer
// insertCounterContainer
}
function getOrCreateContainer() {}
// ... and more
}
Standard Language Interfaces: Implement essential interfaces (equality, comparison, ordering, etc.) for necessary data types as required by target programming languages.
Additional Enhancements: And many other improvements to enhance usability and developer experience.
This project is licensed under the MIT License - see the LICENSE file for details.