worldview

Function worldview 

Source
pub fn worldview(worldview: &WorldView, connection: Option<ConnectionStatus>)
Expand description

Logs the current WorldView state to the terminal in a structured and colorized table format.

This function visually presents the status of the elevator system, including:

  • Network connection status (internet and elevator mesh)
  • Packet loss as a colored percentage and visual bar
  • Hall calls across all floors (up/down requests)
  • Detailed state of each elevator (ID, door, obstruction, last floor, cab requests, hall tasks, etc.)

The display uses Unicode symbols and ANSI color codes for clarity:

  • Green/red circles for active/inactive requests
  • Directional arrows and colors to indicate elevator movement or door states

§Parameters

  • worldview: A reference to the current global WorldView instance.
  • connection: An optional ConnectionStatus containing internet and elevator network status as well as the current packet loss (0–100%).

§Behavior

  • If configured printing is disabled (config::PRINT_WV_ON is false), the function exits early.
  • Displays high-level metadata, followed by per-elevator breakdown.
  • Pads and aligns all output to fit well in monospaced terminal environments.

§Notes

  • This is intended for human-readable debugging and monitoring purposes.
  • Printing frequency should be limited (e.g., once per 500 ms).