Replies: 7 comments 2 replies
-
I've admittedly not tried this myself, so this might not work, but you may be able to have your cake and eat it too to some extent by adding to the pub enum PositionedEnum {
BedRecord(bed::record::Record<3>),
GenericExtendablePositioned(Box<dyn Positioned>),
} Then if people want to extend the API the easy way and take the performance hit from the dynamic dispatch they can. |
Beta Was this translation helpful? Give feedback.
-
wow. I like this idea! I think it's a great balance--we get static dispatch for the common, supported types but also allow user-added. thanks very much! |
Beta Was this translation helpful? Give feedback.
-
I started stubbing this out here |
Beta Was this translation helpful? Give feedback.
-
My initial reaction is: are you sure you want/need heterogeneous collections of You can always instantiate a more generic I think there 3 advantages of the generics approach:
Drawbacks:
Anyway, not sure that's the right way to go, but might be worth exploring a bit to see how it feels. |
Beta Was this translation helpful? Give feedback.
-
@pmarks I'm still not a seasoned rust developer, so bear with me. |
Beta Was this translation helpful? Give feedback.
-
The enum approach is mostly implemented here. There's a sizable performance hit:
I think it is still worth it as matching on the enum will be quite nice and perhaps we can remove the |
Beta Was this translation helpful? Give feedback.
-
This is implemented and incorporated into main branch.
|
Beta Was this translation helpful? Give feedback.
-
We seek input from the rust genomics community about the design. Specifically issue#2
We are interested in brain-storming the benefits of the
Box<dyn>
approach vs theenum
approach which allows static dispatch and extracting the exact Struct. While Box is more flexible in some ways, it has many downsides.Beta Was this translation helpful? Give feedback.
All reactions