impl Drop for PyIndex {
fn drop(&mut self) {
//self.index.prepare_for_closing().wait();
}
}
This would allow us to explicitly close the database, which is needed if we want to programmatically remove the underlying directory where an Index has been created, e.g. after del index or during Index's __enter__ and __exit__.
The issue with this is that Index.prepare_for_closing() takes the ownership of the value but drop(&mut self) is taking a reference. (Not sure if this sentence makes sense, I'm not a Rust programmer; just expressing my vague intuition).
In Rust words:
[...] cannot move out of `self.index` which is behind a mutable reference
We should implement the
Drop
trait forPyIndex
:This would allow us to explicitly close the database, which is needed if we want to programmatically remove the underlying directory where an Index has been created, e.g. after
del index
or duringIndex
's__enter__
and__exit__
.The issue with this is that
Index.prepare_for_closing()
takes the ownership of the value but drop(&mut self
) is taking a reference. (Not sure if this sentence makes sense, I'm not a Rust programmer; just expressing my vague intuition).In Rust words: