The .raze() method of View requires several parameters:
- A DeferredWorld
- The
View that was used to create the view output.
- The
View::State.
So for example, Element::raze() uses the element's entity id (to despawn it) as well as the child views and the components, which also may need cleanup.
However, having to keep around both the View and View::State in order to cleanup View::State is troublesome. It would be convenient if somehow View::State could be despawnable by itself, but this would mean that it would have to have a more complex type, and this is true for every type that implements View.
Views are especially troublesome to keep around since, in general, they are not copyable or cloneable. This means having to wrap them in an Arc or some other container in order to keep them.
The
.raze()method ofViewrequires several parameters:Viewthat was used to create the view output.View::State.So for example,
Element::raze()uses the element's entity id (to despawn it) as well as the child views and the components, which also may need cleanup.However, having to keep around both the
ViewandView::Statein order to cleanupView::Stateis troublesome. It would be convenient if somehowView::Statecould be despawnable by itself, but this would mean that it would have to have a more complex type, and this is true for every type that implementsView.Views are especially troublesome to keep around since, in general, they are not copyable or cloneable. This means having to wrap them in an Arc or some other container in order to keep them.