You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lifetime 'plane is problematic here, in my opinion, as the compiler has no way to "tie" this to another existing lifetime (like 'opts or 'parent). This leads to assign the reference to the newly created child plane, an unknown lifetime. And because of this is it tricky to use this plane as a field of struct since constraining the reference with the lifetime constraints of the struct is not viable.
If I recall correctly, all children planes would be destroyed on destruction of parent and hence it makes sense to constraint the child reference to live as long as parent ('parent lifetime), instead of an arbitrary lifetime ('plane).
So, I want to ask how should I go about it? Because I'm using a child plane as a field in a struct, something along the lines of -
And assigning Widget { plane : NcPlane::new_child(parent_plane, ...) } just leads to compilation complications as we nest structs and all.
Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
This library doesn't implement the Drop trait, you'll have to call the destructor methods, ideally by implementing Drop in the wrapping structure that owns the notcuses state.
Wrapping everything in Rust owned types would make this library too different from the way the C API can be used, and this library tries to remain close to that. But there's anoher more rusty library planned, once this one is a bit more mature.
I'm glad you're trying to build something with it, real cases are the best tests.
Hi, before I ask, let me tell that I'm myself a beginner in Rust.
Doubt
NcPlane::new_child
has the following signature -The lifetime
'plane
is problematic here, in my opinion, as the compiler has no way to "tie" this to another existing lifetime (like'opts
or'parent
). This leads to assign the reference to the newly created child plane, an unknown lifetime. And because of this is it tricky to use this plane as a field of struct since constraining the reference with the lifetime constraints of the struct is not viable.If I recall correctly, all children planes would be destroyed on destruction of parent and hence it makes sense to constraint the child reference to live as long as parent (
'parent
lifetime), instead of an arbitrary lifetime ('plane
).So, I want to ask how should I go about it? Because I'm using a child plane as a field in a struct, something along the lines of -
And assigning
Widget { plane : NcPlane::new_child(parent_plane, ...) }
just leads to compilation complications as we nest structs and all.Am I doing something wrong?
The text was updated successfully, but these errors were encountered: