Open
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
.