cucapra / pollen

generating hardware accelerators for pangenomic graph queries
MIT License
24 stars 1 forks source link

Use newtypes for the arena types #175

Closed sampsyo closed 1 month ago

sampsyo commented 1 month ago

Our little homegrown arena library, called pool, is a little like id-arena or similar, but with special stuff we need for our "zero-copy" use case.

Previously, it was implemented as special traits that extend plain old Rust types like &[T] and Vec<T>. This was convenient in some ways but got confusing and prevented some fancier convenience features. I've now wrapped these in newtypes Store and Pool that let us more carefully control the interface to the arenas. This should be less error-prone in the long run. As an added bonus, it makes it easier to access pools with subscripting: for example, gfa.segs[id] works where id has type Id<Segment>.