Anders429 / brood

A fast and flexible entity component system library.
Apache License 2.0
39 stars 1 forks source link

Reduce the number of generic parameters in public traits and methods. #206

Closed Anders429 closed 1 year ago

Anders429 commented 1 year ago

Fixes #192.

This reduces all of the many generic index parameters down to a single Indices parameter for all public traits and most public methods. The exceptions are with queries and systems, which still require 4 index parameters due to the four separate trait bounds. Future work could combine these trait bounds into a single trait (they only became separated because Resources and Entry views were introduced after registry::ContainsQuery was already defined).

This also addresses #188 a bit, replacing the iterators in System::run() and ParSystem::run() with a generic iterator I. There is still more that can be done on this front, possibly with replacing the entire query_results with a generic trait, but for now this is a great step forward.

codecov[bot] commented 1 year ago

Codecov Report

Merging #206 (9dee20e) into dev (0bb0ab9) will increase coverage by 0.61%. The diff coverage is 81.61%.

@@            Coverage Diff             @@
##              dev     #206      +/-   ##
==========================================
+ Coverage   94.85%   95.47%   +0.61%     
==========================================
  Files          89       89              
  Lines       15477    14147    -1330     
==========================================
- Hits        14681    13507    -1174     
+ Misses        796      640     -156     
Impacted Files Coverage Δ
src/entities/mod.rs 100.00% <ø> (ø)
src/registry/contains/views/sealed.rs 98.00% <ø> (ø)
src/system/schedule/scheduler.rs 100.00% <ø> (ø)
src/system/schedule/sealed.rs 100.00% <ø> (ø)
src/system/schedule/stager.rs 100.00% <ø> (ø)
src/system/schedule/stages.rs 100.00% <ø> (ø)
src/system/schedule/task/sealed.rs 100.00% <ø> (ø)
src/system/schedule/mod.rs 73.93% <33.60%> (-1.82%) :arrow_down:
src/query/result/par_iter.rs 83.14% <92.85%> (-2.15%) :arrow_down:
src/archetype/mod.rs 98.07% <100.00%> (ø)
... and 10 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Anders429 commented 1 year ago

The low patch coverage seems to be due to the amount of lines edited in schedule/mod.rs. Those lines already have poor coverage because they are not intended to be run at all. Overall, this PR raises coverage :)