MCPcopy Create free account
hub / github.com/aeroxy/chrome-devtools-cli / format_node_details

Function format_node_details

src/commands/memory.rs:223–250  ·  view source on GitHub ↗

Format single node inspection details for display.

(
    node_id: u64,
    name: &str,
    self_size: u64,
    format: crate::format::OutputFormat,
)

Source from the content-addressed store, hash-verified

221
222/// Format single node inspection details for display.
223pub fn format_node_details(
224 node_id: u64,
225 name: &str,
226 self_size: u64,
227 format: crate::format::OutputFormat,
228) -> Result<String> {
229 if format.is_text() {
230 let mut out = String::new();
231 out.push_str("nodeId,nodeName,selfSize\n");
232 let escaped_name = if name.contains(',') || name.contains('"') || name.contains('\n') || name.contains('\r') {
233 format!("\"{}\"", name.replace('"', "\"\""))
234 } else {
235 name.to_string()
236 };
237 out.push_str(&format!(
238 "{},{},{}\n",
239 node_id, escaped_name, self_size
240 ));
241 Ok(out)
242 } else {
243 let details = json!({
244 "nodeId": node_id,
245 "nodeName": name,
246 "selfSize": self_size,
247 });
248 Ok(crate::format::format_structured(&details, format)?)
249 }
250}
251
252/// Offline variant that doesn't require a Chrome connection. Used by the CLI's
253/// early-intercept path so `inspect-heapsnapshot-node` works without a running

Calls 2

format_structuredFunction · 0.85
is_textMethod · 0.80