mirror of
https://github.com/bevyengine/bevy
synced 2024-11-29 08:00:20 +00:00
Replace derive(Default) with impl in AssetCountDiagnosticsPlugin (#2077)
Hi, ran into this problem with the derive macro. It fails trying to derive the Default trait when the asset does not implements it also. This is unnecessary because this plugin does not need that from the asset type, just needs to create the phantom data.
This commit is contained in:
parent
3af3334cfe
commit
5390be0871
1 changed files with 8 additions and 1 deletions
|
@ -4,11 +4,18 @@ use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics};
|
||||||
use bevy_ecs::system::{IntoSystem, Res, ResMut};
|
use bevy_ecs::system::{IntoSystem, Res, ResMut};
|
||||||
|
|
||||||
/// Adds "asset count" diagnostic to an App
|
/// Adds "asset count" diagnostic to an App
|
||||||
#[derive(Default)]
|
|
||||||
pub struct AssetCountDiagnosticsPlugin<T: Asset> {
|
pub struct AssetCountDiagnosticsPlugin<T: Asset> {
|
||||||
marker: std::marker::PhantomData<T>,
|
marker: std::marker::PhantomData<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T: Asset> Default for AssetCountDiagnosticsPlugin<T> {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
marker: std::marker::PhantomData,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Asset> Plugin for AssetCountDiagnosticsPlugin<T> {
|
impl<T: Asset> Plugin for AssetCountDiagnosticsPlugin<T> {
|
||||||
fn build(&self, app: &mut AppBuilder) {
|
fn build(&self, app: &mut AppBuilder) {
|
||||||
app.add_startup_system(Self::setup_system.system())
|
app.add_startup_system(Self::setup_system.system())
|
||||||
|
|
Loading…
Reference in a new issue