Skip to main content

freya/_docs/
devtools.rs

1//! # Devtools
2//!
3//! Freya ships with a companion devtools application that lets you inspect and debug your running app in real time.
4//! With it you can browse the node tree, inspect element styles, layout, and text styles, highlight elements on hover, and control animation speed.
5//!
6//! ## Enabling Devtools
7//!
8//! The devtools server is gated behind the `devtools` feature flag.
9//! The recommended approach is to declare a feature in **your own crate** that forwards to Freya's, so devtools are never included in default or release builds:
10//!
11//! ```toml
12//! # In your Cargo.toml
13//! [features]
14//! devtools = ["freya/devtools"]
15//! ```
16//!
17//! Then run your app with the feature enabled:
18//!
19//! ```sh
20//! cargo run --features devtools
21//! ```
22//!
23//! No code changes are needed. When the feature is active, Freya's `launch` function automatically registers the devtools server plugin.
24//!
25//! ## Running the Devtools App
26//!
27//! The devtools UI is a separate standalone application (`freya-devtools-app`).
28//! Install it once with:
29//!
30//! ```sh
31//! cargo install freya-devtools-app
32//! ```
33//!
34//! Then, while your app is running with the `devtools` feature enabled, start the devtools app:
35//!
36//! ```sh
37//! freya-devtools-app
38//! ```
39//!
40//! The devtools app will connect to your running application automatically. If the app is not running yet it will keep retrying until it connects.
41//!
42//! ## Limitations
43//!
44//! Only **one** Freya application with devtools enabled can run at a time.
45//! The embedded server listens on a fixed port (`7354` on localhost), so launching a second devtools-enabled app will fail to bind that port.
46//! Make sure to close any previous devtools-enabled instance before starting a new one.