Closed as not planned
Description
I have a struct with a few members I am also exposing in my Lua API.
At the moment I wrap the struct member in an Rc, though this is technically incorrect since wgpu safety requires my window to outlive surfaces.
struct Example {
foo: Foo,
bar: Bar, // must outlive foo
}
I think something like this would be quite nice:
struct Example {
scope: mlua::Scope,
foo: Foo,
bar: Bar, // must outlive foo and scope
}
lua.register_userdata_type::<EventLoopWindowTarget<()>>(|reg| {
reg.add_field_method_get("foo", |_, this| {
this.scope.create_any_userdata_ref(&this.foo)
});
})?;
Metadata
Metadata
Assignees
Labels
No labels