Skip to content
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

Add frunk feature that derives LabelledGeneric for arrays to allow using Transmogrifier to select fields on generated array structs #99

Open
mbrobbel opened this issue Aug 3, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@mbrobbel
Copy link
Owner

mbrobbel commented Aug 3, 2023

#[derive(frunk::labelled::LabelledGeneric)]
struct FooArray {
  a: BooleanArray,
  b: Uint32Array,
}

#[derive(frunk::labelled::LabelledGeneric)]
struct SelectA {
  a: BooleanArray,
}

let foo_array: FooArray = ...

// Select `a` from the FooArray
let select_a: SelectA = foo_array.transmogrify();

We could even generate these selector structs and add methods on the main array to use them.

@mbrobbel mbrobbel added the enhancement New feature or request label Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant