Docstrings rarely have unicode characters so these are not adding much
value. They present an issue for the downstream moz-central crate
(https://bugzilla.mozilla.org/show_bug.cgi?id=1894888), so let's remove
them.
Implemented our own oneshot channel using a Mutex. It's not quite as
efficient as the `oneshot` one, but I think it should be fine for our
purposes. My gut feeling is that the loss of overhead is neglibable
compared the other existing overhead that UniFFI adds.
The API of the new oneshot is basically the same, except send/recv are
not failable.
These are alternate versions of the current scaffolding functions that
use u64 buffers to handle their input/output.
The main use case is the gecko-js bindings used in Firefox. This allows
us to replace the generated C++ code with static code, since the
scaffolding functions now always have the exact same signature.
This commit generates FFI buffer versions for scaffolding functions
defined for user functions/methods. It does not generate them for
functions with known/static signatures like the rust buffer FFI
functions, or the object clone/delete functions. If the signature is
always the same, then there isn't a problem calling the normal
scaffolding functions.
Implemented our own oneshot channel using a Mutex. It's not quite as
efficient as the `oneshot` one, but I think it should be fine for our
purposes. My gut feeling is that the loss of overhead is neglibable
compared the other existing overhead that UniFFI adds.
The API of the new oneshot is basically the same, except send/recv are
not failable.
These are alternate versions of the current scaffolding functions that
use u64 buffers to handle their input/output.
The main use case is the gecko-js bindings used in Firefox. This allows
us to replace the generated C++ code with static code, since the
scaffolding functions now always have the exact same signature.
This commit generates FFI buffer versions for scaffolding functions
defined for user functions/methods. It does not generate them for
functions with known/static signatures like the rust buffer FFI
functions, or the object clone/delete functions. If the signature is
always the same, then there isn't a problem calling the normal
scaffolding functions.
Docstrings rarely have unicode characters so these are not adding much
value. They present an issue for the downstream moz-central crate
(https://bugzilla.mozilla.org/show_bug.cgi?id=1894888), so let's remove
them.
* Increase BUF_SIZE to 16384 (from 4096), allowing large errors (enums) to be used. Add fixture which unit tests fails even for BUF_SIZE of 8198, but works with 16k.
These methods input a completion function that they call when the async
function is complete. They return a ForeignFuture struct, which
represents the foreign task object and is used to drop/cancel futures.
Like Rust, dropping and cancelling are coupled together into one operation.
- Added `RustCallStatus` as an `FfiType` variant, since I wanted to use
it in the `ForeignFutureResult` structs. In theory, we could define
`RustCallStatus` a `FfiType::Struct`, but I didn't want to introduce
that change in this PR.
- Fixed the result mapping code to work with async functions. Before we
were executing the mapping call, then awaiting the result, but we need
to do that in the opposite order (`foo.into().await` vs `foo.await.into()`).
Also, specify the return type generics for `rust_future_new` so that
the Rust can figure out the into() generics.
This only updates the CHANGELOG and version numbers. All the functional
changes were already in main.
Whiile merging the changelog, I also removed a duplicate "What's new"
header and moved the "All changes" link to the bottom of the entry.
BREAKING CHANGE:
Named arguments to struct constructors are now required.
Note that this now allows default values before non-default ones, which
previously lead to a syntax error in generated Python.
This was pretty easy, it mostly meant not hard coding that we don't
support async methods and which order to apply `#[uniffi::export]` vs
`#[async_trait::async_trait]`.
The next step is foreign-implemented traits.
This brings in the `into_raw` and `from_raw` methods that we may want to
use to pass oneshot senders over the FFI. It still uses my patched
version to avoid #1736.
Currently, `lower()` always returns a borrow of the object handle. This
is fine for function arguments, since you know the object is still
alive on the stack while the function is being called. However, for
function returns this is not correct.
To fix this: clone the handle in `lower()`. Added a test for this -- it
was surprisingly easy to cause a segfault with the current behavior.
Removed the reexport-scaffolding-macro fixture which broke and often
requires changes when the FFI changes. I don't think it's giving us
enough value at this point to justify continuing to update it.
This fixture is testing the foreign executor code, which isn't actually
used in practice. I hope to add similar functionality, but that's
probably going to use a new fixture anyways, for example:
5cabadaaaa
Docstrings are declared in .udl file by prefixing a line with three
slashes ///. Docstrings can be placed basically anywhere - functions,
objects, methods, constructors, callbacks, etc.. A docstring placed in
a wrong place will generate UDL parser error.