Crate tick_queue

source
Expand description

§Tick Queue Crate

The tick-queue crate provides utilities for managing a sequence of items. Each item is associated with a unique tick identifier (TickId), ensuring that items are processed in the correct order.

The crate offers functionality for pushing items, iterating over them, and managing the internal state of the item queue. It supports both direct manipulation of the item queue and indexed iteration.

§Example

use tick_queue::{Queue, ItemInfo};
use tick_id::TickId;

// Create a new Queue instance with an initial tick
let mut queue = Queue::new(TickId::new(0));

// Push items into the queue
queue.push(TickId::new(0), "Step 1").unwrap();
queue.push(TickId::new(1), "Step 2").unwrap();

// Pop the first item
let item = queue.pop();
assert_eq!(item.unwrap().item, "Step 1");

// Iterate over remaining items
for item in queue.iter() {
  println!("Tick {}: {}", item.tick_id, item.item);
}

Structs§

Enums§

Constants§