Skip to main content

Crate lupa

Crate lupa 

Source
Expand description

§lupa

Interactive object inspector for Rust.

Drop-in replacement for dbg! that opens a local web UI and a TUI where you can explore your structs as a collapsible tree, diff snapshots, and search fields — all with zero configuration.

§Quick start

use lupa::{inspect, snapshot, snapshot_diff};

let mut user = User::new("Alice");
inspect!(user);          // opens http://localhost:7777

let s1 = snapshot!(user);
user.add_role(Role::Admin);
inspect!(user);
snapshot_diff!(s1, user); // diff tab shows what changed

lupa::keep_alive();      // blocks until Ctrl+C

§Feature flags

  • web (enabled by default): provides the HTTP + WebSocket server and the web‑based inspector interface.
  • tui: enables the terminal‑based inspector (ratatui + crossterm).

With only web the program starts the web server and blocks (or runs keep_alive). With only tui it runs the terminal interface. With both features you can choose the mode at runtime via RunMode.

Re-exports§

pub use state::Snapshot;

Modules§

diff
Line‑by‑line diff computation between two snapshots.
server
HTTP + WebSocket server for the lupa web inspector.
state
Central storage for all snapshots and diffs collected during program execution.

Macros§

inspect
Captures a snapshot of any value that implements Debug and sends it to the lupa inspector (web UI and/or TUI).
snapshot
Creates a named snapshot without immediately sending it to the inspector.
snapshot_diff
Computes a diff between two snapshots and sends the result to the inspector.

Enums§

RunMode
Runtime selection of which inspector interface(s) to activate.

Functions§

keep_alive
Blocks the current thread, keeping the web server alive until Ctrl+C.
run
Automatically chooses a RunMode based on the enabled feature flags.
run_mode
Starts the inspector with the explicitly requested RunMode.