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

Tell the bindings about traits implemented by objects. #2196

Open
mhammond opened this issue Jul 26, 2024 · 0 comments
Open

Tell the bindings about traits implemented by objects. #2196

mhammond opened this issue Jul 26, 2024 · 0 comments

Comments

@mhammond
Copy link
Member

In #2169 there's:

#[uniffi::export]
impl AutoComplete for Bip39AutoComplete {

and we should support it! It could mean

Generating the metadata for this is actually quite easy and sane (I've a wip ;), and we could land this without bindings support, which would be the hard part to do "correctly" - but that could come later and it's not strictly necessary for all bindings to support it.

wdyt?

mhammond added a commit to mhammond/uniffi-rs that referenced this issue Aug 6, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance or whatever makes sense for them if they choose.

No bindings use it yet, fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Aug 6, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance or whatever makes sense for them if they choose.

No bindings use it yet, fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Aug 6, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance or whatever makes sense for them if they choose.

No bindings use it yet, fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Aug 6, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance or whatever makes sense for them if they choose.

No bindings use it yet, fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Sep 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance

Includes Python, Kotlin and Swift generating these sub-classes.
There's some undesirable re-wrapping when traits from these
objects gets passed back and forward, but seems to work surprisingly well.

Fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Sep 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance

Includes Python, Kotlin and Swift generating these sub-classes.
There's some undesirable re-wrapping when traits from these
objects gets passed back and forward, but seems to work surprisingly well.

Fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Sep 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance

Includes Python, Kotlin and Swift generating these sub-classes.
There's some undesirable re-wrapping when traits from these
objects gets passed back and forward, but seems to work surprisingly well.

Fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Sep 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance

Includes Python, Kotlin and Swift generating these sub-classes.
There's some undesirable re-wrapping when traits from these
objects gets passed back and forward, but seems to work surprisingly well.

Fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Sep 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Currently works by ignoring `MyTrait`. This adds new metadata
to record it, allowing foreign bindings to implement things like
inheritance

Includes Python, Kotlin and Swift generating these sub-classes.
There's some undesirable re-wrapping when traits from these
objects gets passed back and forward, but seems to work surprisingly well.

Fixes mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Oct 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Previously worked as it ignored `MyTrait`. This adds new metadata to record it,
allowing foreign bindings to implement things like inheritance.

Includes Python generating an inheritance chain to reflect this relationship.

This will not generate correct code if a struct declares more than 1 trait,
and there's some undesirable re-wrapping when traits from these objects gets
passed back and forward, but seems to work surprisingly well.

On the path to mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Oct 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Previously worked as it ignored `MyTrait`. This adds new metadata to record it,
allowing foreign bindings to implement things like inheritance.

Includes Python generating an inheritance chain to reflect this relationship.

This will not generate correct code if a struct declares more than 1 trait,
and there's some undesirable re-wrapping when traits from these objects gets
passed back and forward, but seems to work surprisingly well.

On the path to mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Oct 4, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Previously worked as it ignored `MyTrait`. This adds new metadata to record it,
allowing foreign bindings to implement things like inheritance.

Includes Python generating an inheritance chain to reflect this relationship.

This will not generate correct code if a struct declares more than 1 trait,
and there's some undesirable re-wrapping when traits from these objects gets
passed back and forward, but seems to work surprisingly well.

On the path to mozilla#2196.
mhammond added a commit to mhammond/uniffi-rs that referenced this issue Oct 6, 2024
```
#[uniffi::export]
impl MyTrait for MyObject { ... }
```

Previously worked as it ignored `MyTrait`. This adds new metadata to record it,
allowing foreign bindings to implement things like inheritance.

Includes Python generating an inheritance chain to reflect this relationship.

This will not generate correct code if a struct declares more than 1 trait,
and there's some undesirable re-wrapping when traits from these objects gets
passed back and forward, but seems to work surprisingly well.

Fixes mozilla#2196.
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

No branches or pull requests

1 participant