-
Notifications
You must be signed in to change notification settings - Fork 5
refactor tree iteration #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
To make this viable, we need to extract |
49add21
to
c3f5d16
Compare
c3f5d16
to
07319c7
Compare
Due to the ownership semantics of a tree sequence on the C side, we may not be able to do this safely w/o using Rc to manage the lifetime of that C side allocation. Being able to collect into a vector of trees hides the fact that those data must have a lifetime tied to the tree sequence somehow. |
Difficulties for this PR include:
The safest method is the current use of a lending iterator. Ways to work around some of these difficulties:
All of these workarounds are too big for a single PR. |
This PR implements a "natural" iterator over trees:
impl Iterator
.TreeSequence::trees
returning the iterator.