-
Notifications
You must be signed in to change notification settings - Fork 210
Open
Labels
breaking-changeIssues and PRs that are breaking to fix/merge.Issues and PRs that are breaking to fix/merge.c: coreComponent: core (mod core_types, object, log, init, ...)Component: core (mod core_types, object, log, init, ...)quality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internalsstatus: upstreamIssue that originates in an upstream project and can't be dealt with here.Issue that originates in an upstream project and can't be dealt with here.
Milestone
Description
For example, the following code will not work.
#[derive(NativeClass)]
#[no_constructor]
struct Foo {}
#[methods]
impl Foo {
#[export]
fn get(&self, _owner: &Reference) -> Option<Instance<Foo, Unique>> {
Some((Foo{}).emplace())
}
}
This issue can be avoided by using into_shared() to perform type conversion.
#[derive(NativeClass)]
#[no_constructor]
struct Foo {}
#[methods]
impl Foo {
#[export]
fn get(&self, _owner: &Reference) -> Option<Instance<Foo>> {
Some((Foo{}).emplace().into_shared())
}
}
I tried to solve this issue, but implementing impl<T: OwnedToVariant > OwnedToVariant for Option<T>
causes a conflict with impl<T: ToVariant> OwnedToVariant for T
.
Metadata
Metadata
Assignees
Labels
breaking-changeIssues and PRs that are breaking to fix/merge.Issues and PRs that are breaking to fix/merge.c: coreComponent: core (mod core_types, object, log, init, ...)Component: core (mod core_types, object, log, init, ...)quality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internalsstatus: upstreamIssue that originates in an upstream project and can't be dealt with here.Issue that originates in an upstream project and can't be dealt with here.