Remove almost all unsafe code and fixed a memory leak in Evtree
#2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The only unsafe left is in the
IterMut
and the parent references. Down to only 7 unsafe usages inradiate_matrix_evtree
crate and no unsafe in the other crates.Split
Evtree
so that the tree code is now generic and separate from theNeuralNetwork
&Genome
logic.Fixed the level order iterator (it was returning all left node first) and added some unit tests to test the iterators.
The only way to remove the remaining unsafe code would be to use something like
Rc<RefCell<>>
and Weak references for the parent.