amethyst / amethyst/specs

Turn MaskedStorage into a safe wrapper around UnprotectedStorage

オープン
#664 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
feature-request
主要言語
Rust
スター
2.6k
フォーク
215
PR マージ指標
30日以内にマージされた PR はありません

説明

At the moment, `MaskedStorage` requires a `Component` bound on its type parameter, and it's missing two of the methods that `UnprotectedStorage` offers. I think it would make the type more flexible, with relatively little work, if the following changes were made:

* Remove the `T: Component` bound, instead adding a second type parameter `S` for the storage, with a `S: UnprotectedStorage` bound.
* Add the missing methods `.get` and `.get_mut` that forward to the corresponding `UnprotectedStorage` methods.

With these changes, the `MaskedStorage` type could be used for any `T`, anything that needs an ID for lookup would work, not just components. It would make it simply a safe wrapper around `UnprotectedStorage`. An example is Amethyst, which currently uses `UnprotectedStorage` for asset storage, but which has had to build its own safety wrappers. If `MaskedStorage` were changed in this way, users could use that type instead, without safety concerns.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。