Skip to content

Why AnyHistory is an enum and not a wrapper around Box<dyn History> #2933

Answered by futursolo
Neo-Ciber94 asked this question in Q&A
Discussion options

You must be logged in to vote

Boxing a struct involves an additional allocation and using enumerate can avoid the allocation.

The History trait is also not object safe (required for boxing) as it uses generics on its methods.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by futursolo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants