Skip to content

Commit

Permalink
Adds derive for missing debug implementations (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsr authored Oct 1, 2020
1 parent d52f9e3 commit 3a4eacb
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion crates/bevy_app/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum State {
///
/// // events are only processed once per reader
/// assert_eq!(reader.iter(&events).count(), 0);
/// ```
/// ```
///
/// # Details
///
Expand Down Expand Up @@ -83,6 +83,7 @@ fn map_instance_event<T>(event_instance: &EventInstance<T>) -> &T {
}

/// Reads events of type `T` in order and tracks which events have already been read.
#[derive(Debug)]
pub struct EventReader<T> {
last_event_count: usize,
_marker: PhantomData<T>,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_core/src/time/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use instant::Instant;
use std::time::Instant;

/// Tracks elapsed time since the last update and since the App has started
#[derive(Debug)]
pub struct Time {
pub delta: Duration,
pub instant: Option<Instant>,
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_ecs/hecs/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use crate::{borrow::AtomicBorrow, query::Fetch, Access, Component, Query};
///
/// Accessing `Archetype`s is only required for complex dynamic scheduling. To manipulate entities,
/// go through the `World`.
#[derive(Debug)]
pub struct Archetype {
types: Vec<TypeInfo>,
state: HashMap<TypeId, TypeState>,
Expand Down Expand Up @@ -439,6 +440,7 @@ impl Drop for Archetype {
}

/// Metadata about a type stored in an archetype
#[derive(Debug)]
pub struct TypeState {
offset: usize,
borrow: AtomicBorrow,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/hecs/src/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use core::{

use crate::{archetype::Archetype, Component, MissingComponent};

#[derive(Debug)]
pub struct AtomicBorrow(AtomicUsize);

impl AtomicBorrow {
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_ecs/hecs/src/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl fmt::Debug for Entity {
}
}

#[derive(Default)]
#[derive(Debug, Default)]
pub(crate) struct Entities {
pub meta: Vec<EntityMeta>,
// Reserved entities outside the range of `meta`, having implicit generation 0, archetype 0, and
Expand Down Expand Up @@ -333,14 +333,14 @@ impl EntityReserver {
}
}

#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub(crate) struct EntityMeta {
pub generation: u32,
pub location: Location,
}

/// A location of an entity in an archetype
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub struct Location {
/// The archetype index
pub archetype: u32,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/hecs/src/world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use crate::{
///
/// The components of entities who have the same set of component types are stored in contiguous
/// runs, allowing for extremely fast, cache-friendly iteration.
#[derive(Debug)]
pub struct World {
entities: Entities,
index: HashMap<Vec<TypeId>, u32>,
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_ecs/src/resource/resource_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl<'a, T: Resource> Deref for ChangedRes<'a, T> {
}

/// Shared borrow of a Resource
#[derive(Debug)]
pub struct Res<'a, T: Resource> {
value: &'a T,
}
Expand Down Expand Up @@ -87,6 +88,7 @@ impl<'a, T: Resource> Deref for Res<'a, T> {
}

/// Unique borrow of a Resource
#[derive(Debug)]
pub struct ResMut<'a, T: Resource> {
_marker: PhantomData<&'a T>,
value: *mut T,
Expand Down Expand Up @@ -139,6 +141,7 @@ impl<'a, T: Resource> UnsafeClone for ResMut<'a, T> {

/// Local<T> resources are unique per-system. Two instances of the same system will each have their own resource.
/// Local resources are automatically initialized using the FromResources trait.
#[derive(Debug)]
pub struct Local<'a, T: Resource + FromResources> {
value: *mut T,
_marker: PhantomData<&'a T>,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/src/system/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use bevy_tasks::ParallelIterator;
use std::marker::PhantomData;

/// Provides scoped access to a World according to a given [HecsQuery]
#[derive(Debug)]
pub struct Query<'a, Q: HecsQuery> {
pub(crate) world: &'a World,
pub(crate) archetype_access: &'a ArchetypeAccess,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub trait System: Send + Sync {
}

/// Provides information about the archetypes a [System] reads and writes
#[derive(Default)]
#[derive(Debug, Default)]
pub struct ArchetypeAccess {
pub immutable: FixedBitSet,
pub mutable: FixedBitSet,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_input/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use bevy_utils::HashSet;
use std::hash::Hash;

/// A "press-able" input of type `T`
#[derive(Debug)]
pub struct Input<T> {
pressed: HashSet<T>,
just_pressed: HashSet<T>,
Expand Down

0 comments on commit 3a4eacb

Please sign in to comment.