You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
Index returned from Arena<TypeA> should not be used in Arena<TypeB>, but we dont use generics in index, so such type constraint not exist. To enforce compiletime check better we can add generics in index: Arena insert item and return Index.
Hello, making the Index generic will probably bind it to the std, which against the aim of this repo.
You can easily clone the repo and change the Index class into
In order to properly enforce this, it would require an invariant lifetime like drop_arena, which would make it incredibly painful to include an Arena as a field in any other structure (markcsaving/drop_arena#1). However, an Index generic over the value type could still be useful for structs that contain Indexes to multiple arenas, because then it would at least be obvious which Index goes to which arena.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Index returned from
Arena<TypeA>
should not be used inArena<TypeB>
, but we dont use generics in index, so such type constraint not exist. To enforce compiletime check better we can add generics in index: Arena insert item and return Index.some reference https://github.com/gfx-rs/naga/blob/master/src/arena.rs (without generation check)
When using generational-arena to store different type of resource, like scenegraph resource management, such typed Index handle is essential.
The text was updated successfully, but these errors were encountered: