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
In its current implementation, VecResource will drop all contained values when it's deleted, even the uninitialized ones. Depending on what T is, this might go unnoticed for a long time or simply crash (as in my recent case). The correct implementation should probably be something like this:
impl<T:Any + Send + Sync>DropforVecResource<T>{fndrop(&mutself){use std::mem::drop;for i in0..self.storage.v.len(){ifself.storage.g[i] != None{unsafe{drop(self.storage.v.get_unchecked_mut(i));}}}unsafe{self.storage.v.set_len(0);}drop(&mutself.storage.v);drop(&mutself.storage.g);}}
The text was updated successfully, but these errors were encountered:
In its current implementation, VecResource will drop all contained values when it's deleted, even the uninitialized ones. Depending on what T is, this might go unnoticed for a long time or simply crash (as in my recent case). The correct implementation should probably be something like this:
The text was updated successfully, but these errors were encountered: