Hi,
I wanted to store some references inside a component:
pub struct SpriteSheetAnimator<'a> {
pub animations: HashMap<String, Animation>,
pub timer: Timer,
current_frame: u32,
current_animation_name: Option<String>,
current_animation: Option<&'a Animation>,
current_animation_config: Option<&'a AnimationConfig>,
frame_just_changed: bool
}
But this led me to some lifetime troubles.
I am new to Rust and I love bevy because most of the time I don't need to use lifetime.
The error I am facing is this one, inside a system Query:
error[E0477]: the type `SpriteSheetAnimator<'_>` does not fulfill the required lifetime
--> src/lib.rs:20:24
|
20 | mut sprites_query: &'a Query<'_, '_, (&'b mut SpriteSheetAnimator, &mut Handle<Image>, &mut TextureAtlas)>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Is there a way to easily use lifetime within my use case?