timer_data
Serializer-independent data types for Bevy's Timer.
Bevy's Timer doesn't implement common serialization traits. This crate provides TimerData and TimerModeData as plain data types with optional From/Into conversions to Bevy types, plus optional serde and rkyv derives behind feature flags.
Features
| Feature | Default | Description |
|---|---|---|
bevy |
Yes | bevy_time dependency + From/Into conversions for Timer/TimerMode |
serde |
Yes | Serialize/Deserialize derives. With bevy, also #[serde(with)] helpers |
rkyv |
No | Archive/Serialize/Deserialize derives (rkyv 0.8) |
Usage
Serde (#[serde(with)]) — requires bevy + serde
use ;
use Timer;
Direct conversion — requires bevy
use ;
use TimerData;
let timer = from_seconds;
let data: TimerData = .into;
let restored: Timer = data.into;
Without Bevy
use ;
let data = new;
assert_eq!;
Bevy Compatibility
| timer_data | Bevy |
|---|---|
| 0.1 | 0.18 |
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.