Expand description
Checks for the Events<T>
resource being manually inserted through App::init_resource()
or
App::insert_resource()
instead of with App::add_event()
.
§Motivation
Unless you have intentionally and knowingly initialized the Events<T>
resource in this way,
events and their resources should be initialized with App::add_event()
because it
automatically handles dropping old events. Just adding Events<T>
makes no such guarantee, and
will likely result in a memory leak.
For more information, please see the documentation on App::add_event()
and Events<T>
.
§Example
#[derive(Event)]
struct MyEvent;
App::new().init_resource::<Events<MyEvent>>().run();
Use instead:
#[derive(Event)]
struct MyEvent;
App::new().add_event::<MyEvent>().run();
Structs§
Statics§
- Click me for more information.