Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds derive for missing debug implementations #597

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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