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:
Nikita Zdanovitch 2021-05-02 20:00:55 +00:00
parent 3af3334cfe
commit 5390be0871

View file

@ -4,11 +4,18 @@ use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics};
use bevy_ecs::system::{IntoSystem, Res, ResMut};
/// Adds "asset count" diagnostic to an App
#[derive(Default)]
pub struct AssetCountDiagnosticsPlugin<T: Asset> {
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> {
fn build(&self, app: &mut AppBuilder) {
app.add_startup_system(Self::setup_system.system())