Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding FfiType::Handle and use it for Rust futures #1972

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

bendk
Copy link
Contributor

@bendk bendk commented Jan 30, 2024

FfiType::Handle is a opaque 64-bit handle that's used to pass objects across the FFI. This PR changes the rustfuture code to use it and also renames the type used to represent callback interfaces from u64 to handle. The plan is to use it for all object types, including interfaces and trait interfaces, but that will be done in future PRs.

Accompianing that code is the HandleAlloc trait, which has a general system for allocating/using/freeing handles for objects. It's essentially the same system(s) we're currently using, but now the code is all in one place.

On the bindings side, switched the code to using the u64 type rather than having a UniffiHandle type alias. I don't think the type alias is very useful since handles are only used internally. Also, I remember running into Swift issues with the type alias and multiple crates.

Most of this code was copied from the handles PR (#1823).

@bendk bendk requested a review from mhammond January 30, 2024 23:06
@bendk bendk requested a review from a team as a code owner January 30, 2024 23:06
FfiType::Handle is a opaque 64-bit handle that's used to pass objects
across the FFI.  This PR changes the rustfuture code to use it and also
renames the type used to represent callback interfaces from `u64` to
handle.  The plan is to use it for all object types, including
interfaces and trait interfaces, but that will be done in future PRs.

Accompianing that code is the `HandleAlloc` trait, which has a general
system for allocating/using/freeing handles for objects.  It's
essentially the same system(s) we're currently using, but now the code
is all in one place.

On the bindings side, switched the code to using the `u64` type rather
than having a `UniffiHandle` type alias.  I don't think the type alias
is very useful since handles are only used internally.  Also, I remember
running into Swift issues with the type alias and multiple crates.

Most of this code was copied from the handles PR (mozilla#1823).
@bendk bendk merged commit 20223eb into mozilla:main Feb 5, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants