Skip to content

Update flags API. #227

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

Merged
merged 1 commit into from
Mar 26, 2022
Merged

Update flags API. #227

merged 1 commit into from
Mar 26, 2022

Conversation

molpopgen
Copy link
Member

@molpopgen molpopgen commented Mar 25, 2022

Implements several refinements to the handling of "flags":

  • Add NodeFlags
  • Add From<tsk_flags_t> for all flags type.
  • The From is implemented by a macro for all flags types except NodeFlags. From strips off disallowed bits if present.
  • Add impl block for all flags types with a single fn, validate, that checks for invalid flags.

Breaking change:

Node and Individual flags replace tsk_flags_t in the public API, which changes the return value type of some fns. In most cases, this will be transparent.

@molpopgen molpopgen linked an issue Mar 25, 2022 that may be closed by this pull request
@molpopgen molpopgen force-pushed the streamline_flags branch 6 times, most recently from 26897ed to ccf387a Compare March 26, 2022 20:21
* Add RawFlags as typedef for tsk_flags_t
* Add From<RawFlags> for flags types.
  The implementation will remove invalid bits that are set,
  except for NodeFlags/IndividualFlags which allow
  client-defined flags.
* Flags types are now repr(transparent)
* Functions taking flags are now generic over Into<flags type>

Breaking changes:

* Added NodeFlags and InidividualFlags as first-class types.
  Functions previously returning, e.g, &[tsk_flags_t] now
  return &[NodeFlags], etc..  Due to repr(transparent),
  these return values have the same ABI.

Closes #226
@molpopgen molpopgen merged commit aff053c into main Mar 26, 2022
@molpopgen molpopgen deleted the streamline_flags branch March 26, 2022 22:10
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.

Unify treatment of "flags"
1 participant