Skip to content

Commit

Permalink
Add Debug to Has Query type (#12722)
Browse files Browse the repository at this point in the history
# Objective

Pretty minor change to add `Debug` to `Has`.

This is helpful for users (Like me) who have the
[`missing_debug_implementations`](https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/builtin/static.MISSING_DEBUG_IMPLEMENTATIONS.html)
lint turned on.

## Solution

Simple `#[derive(Debug)]`

## Changelog
* Has now implemented `Debug`
  • Loading branch information
Testare authored Mar 28, 2024
1 parent ece6249 commit 1619d42
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/bevy_ecs/src/query/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,12 @@ unsafe impl<T: ReadOnlyQueryData> ReadOnlyQueryData for Option<T> {}
/// ```
pub struct Has<T>(PhantomData<T>);

impl<T> std::fmt::Debug for Has<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "Has<{}>", std::any::type_name::<T>())
}
}

/// SAFETY:
/// `update_component_access` and `update_archetype_component_access` do nothing.
/// This is sound because `fetch` does not access components.
Expand Down

0 comments on commit 1619d42

Please sign in to comment.