Skip to content

remove table struct lifetimes #266

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

Closed
wants to merge 36 commits into from
Closed

Conversation

molpopgen
Copy link
Member

Table types are currently defined as EdgeTable<'a>,
where the lifetime is that of the table collection
owning the tables.

We need to relax this lifetime bound in order to
support standalone tables.

This PR:

  • Removes the lifetime bounds from each table type.
    They now store *const instead of &'a references
    to the low-level table type.
  • Refactors the initialization of TreeSequence and
    TableCollection to store instances of the table
    types.
  • Changes the return types of TableAccess functions
    to be &Table instead of Table.

These changes will go into a new version number.
The last change is technically a break change:
client codes implementing the trait will have their
implementations break. However, I suspect no one has
done so.

Copy link
Member Author

@molpopgen molpopgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to remove some pub fns for NodeTable that take &mut self as references.
This is a BREAKING change.

remove flags_array_mut and time_array_mut from NodeTable.
pub struct TableCollection {
pub(crate) inner: MBox<ll_bindings::tsk_table_collection_t>,
populations: PopulationTable,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is repeating in TreeSequence. We need a new struct to abstract this out.

@molpopgen
Copy link
Member Author

Closing -- see #262.

@molpopgen molpopgen closed this Jul 18, 2022
@molpopgen molpopgen deleted the remove_table_struct_lifetimes branch August 21, 2023 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant