uniffi-rs
2c15607d - Allow passing object instances as args, fields and return values.

Commit
4 years ago
Allow passing object instances as args, fields and return values. This is a significant re-working of how object instances are handled, replacing our previous use of handlemaps with direct use of an `Arc<T>` pointer. This both reduces overhead and allows us to must more easily generate code for dealing with object references. On the Rust side of the world, code that needs to deal with an object reference will typically take an `Arc<T>`, in the spirit of being as explicit as possible. The one exception is when passing objects as arguments, where (like other types) you can annotate the argument with `[ByRef]` and have UniFFI hand you an `&T`. For an example of how this might be used in practice, the "todolist" example has grown the ability to manage a global default list by setting and retreiving a shared object reference. Co-authored-by: Ryan Kelly <rfkelly@mozilla.com>
Author
Committer
rfk rfk
Parents
Loading