Skip to content

Allow [Threadsafe] interfaces access to Arc<Self> #417

@mhammond

Description

@mhammond

We've a use-case where it would be ideal to have access to a clone of the Arc<Self> stored in the ArcHandleMap.

The motivation here is for an app-services component to register with the "sync manager". Without going into too much detail about the "spelling", think something like:

[Threadsafe]
interface Foo {
  [SomethingSomething]
  void register_with_something_external();
}

makes sense, where we call something with the signature:

fn register_with_something_external(self: Arc<Self>) { ... }

which leverages "method receivers". The intent is that we can avoid something gross like an <Arc<Arc<T>> and instead leverage the fact that uniffi already manages the Arc we need.

I'm opening this as a place-holder issue, trying to avoid too much bikeshedding at this stage (hence [SomethingSomething] :) - but I welcome it in general.

cc @rfk @lougeniaC64 @jhugman @dmose

┆Issue is synchronized with this Jira Task

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions