9 releases

0.0.9 Oct 10, 2024
0.0.8 Oct 10, 2024
0.0.7 Apr 28, 2024
0.0.6 Jan 26, 2024

#56 in Simulation

Download history 23/week @ 2024-07-28 1/week @ 2024-08-25 1/week @ 2024-09-01 8/week @ 2024-09-08 41/week @ 2024-09-15 92/week @ 2024-09-22 48/week @ 2024-09-29 276/week @ 2024-10-06 85/week @ 2024-10-13 114/week @ 2024-10-20 33/week @ 2024-10-27 20/week @ 2024-11-03

273 downloads per month
Used in 17 crates (13 directly)

MIT license

6KB
51 lines

📦 tick-id

Session unique Tick ID that specifies a specific tick in a deterministic simulation.

A tick represents any positive integer time period, excluding zero, with typical durations being 16 ms or 32 ms.

TickId is represented as a u32. With each tick equivalent to 16 ms, the maximum duration is approximately 68,719,476 seconds, which translates to about 2.18 years.

“2.18 years should be enough for everyone!”

Installation

[dependencies]
tick-id = "0.0.8"

lib.rs:

The TickId type represents a specific tick in a deterministic simulation.

A tick typically corresponds to a duration of 16 ms or 32 ms, but it can denote any positive integer time period, excluding zero. The TickId is implemented as a u32, allowing for a wide range of tick values.

Example

use tick_id::TickId;

let tick_id = TickId::new(1);
println!("Tick ID: {}", tick_id);

Operations

The TickId type supports addition and subtraction operations, allowing for easy manipulation of tick values. Overflow and underflow are checked during arithmetic operations to ensure safety.

No runtime deps