Thanks to visit codestin.com
Credit goes to docs.rs

Skip to main content

Crate timer_data

Crate timer_data 

Source
Expand description

Serializer-independent data types for Bevy’s Timer.

Bevy’s Timer doesn’t implement common serialization traits. This crate provides TimerData and TimerModeData as intermediate representations with optional From/Into conversions (behind the bevy feature), plus optional serde and rkyv derives behind feature flags.

§Features

  • bevy (default): Enables bevy_time dependency and From/Into conversions between Timer/TimerMode and TimerData/TimerModeData.
  • serde (default): Enables Serialize/Deserialize derives. With bevy, also provides #[serde(with = "timer_data")] helpers.
  • rkyv: Enables Archive/Serialize/Deserialize derives (rkyv 0.8).

§Serde usage

With the bevy + serde features, use #[serde(with = "timer_data")]:

use serde::{Serialize, Deserialize};
use bevy_time::Timer;

#[derive(Serialize, Deserialize)]
pub struct MyComponent {
    #[serde(with = "timer_data")]
    pub timer: Timer,
}

Structs§

HashHex
A 64-bit hash displayed as lowercase hex. Returned by TimerData::hash_hex.
TimerData
Intermediate data representation of a Bevy Timer.

Enums§

TimerDataError
Error returned when TimerData contains invalid state.
TimerModeData
Intermediate data representation of Bevy’s TimerMode.

Functions§

deserialize
Deserialize a Timer via serde.
serialize
Serialize a Timer via serde.