Expand description

Provides a collection of utility functions and structures primarily focused on time-tracking and extracting specific data from string patterns.

Main features:

  • TickTimer: A utility struct that allows easy time-tracking and measures elapsed time in milliseconds since the UNIX epoch. It’s particularly useful for performance measurement and debugging.
  • extract_port_line_numbers: A function that extracts port and line numbers from a specific string pattern (port[number]/line[number]). It’s a quick way to parse such patterns when the exact format is known in advance.

Examples

Using TickTimer for time-tracking:

let mut timer = TickTimer::new(); // Starts the timer
// ... some operations ...
let elapsed = timer.tick(); // Measures time since last tick.
println!("Elapsed time since last tick: {}ms", elapsed);

Extracting port and line numbers from a string:

let input_str = "port0/line32";
let (port, line) = extract_port_line_numbers(input_str);
assert_eq!(port, 0);
assert_eq!(line, 32);

Refer to individual function and struct documentation for detailed usage and examples.

Structs

Functions