Skip to content

Commit 8ae4e5e

Browse files
fazxesclaude
andcommitted
fix(docs): correct devmonitor doctest examples
- Add proper imports for doctests (snowflake_app_lib::*) - Wrap examples in functions with proper AppHandle parameter - Use no_run attribute since examples require runtime context 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 60cce71 commit 8ae4e5e

1 file changed

Lines changed: 29 additions & 10 deletions

File tree

‎src-tauri/src/devmonitor.rs‎

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,22 @@
1010
//!
1111
//! # Usage
1212
//!
13-
//! ```rust
14-
//! use crate::devmonitor::{emit_trace, emit_span_enter, emit_span_exit};
13+
//! ```rust,no_run
14+
//! use snowflake_app_lib::devmonitor::{emit_trace, emit_span_enter, emit_span_exit};
15+
//! use serde_json::json;
16+
//! use tauri::AppHandle;
17+
//!
18+
//! fn example(app: &AppHandle) {
1519
//!
1620
//! // Simple trace event
1721
//! emit_trace(&app, "info", "snowflake::fs", "File saved successfully", None);
1822
//!
1923
//! // Span tracking
2024
//! let span_id = emit_span_enter(&app, "read_file", "snowflake::fs", Some(json!({"path": "/foo"})));
2125
//! // ... do work ...
26+
//! let duration_us = 1000u64;
2227
//! emit_span_exit(&app, span_id, "read_file", "snowflake::fs", duration_us);
28+
//! }
2329
//! ```
2430
2531
use std::fmt::{Debug, Formatter, Result as FmtResult};
@@ -184,9 +190,16 @@ pub fn emit_span_exit(app: &AppHandle, span_id: u64, name: &str, target: &str, d
184190
///
185191
/// # Example
186192
///
187-
/// ```rust
188-
/// trace_info!(app, "File saved successfully");
189-
/// trace_info!(app, "File saved", json!({"path": path}));
193+
/// ```rust,no_run
194+
/// use snowflake_app_lib::trace_info;
195+
/// use serde_json::json;
196+
/// use tauri::AppHandle;
197+
///
198+
/// fn example(app: &AppHandle) {
199+
/// let path = "/foo/bar";
200+
/// trace_info!(app, "File saved successfully");
201+
/// trace_info!(app, "File saved", json!({"path": path}));
202+
/// }
190203
/// ```
191204
#[macro_export]
192205
macro_rules! trace_info {
@@ -235,9 +248,12 @@ macro_rules! trace_debug {
235248
///
236249
/// # Example
237250
///
238-
/// ```rust
239-
/// {
240-
/// let _span = SpanGuard::new(&app, "read_file", module_path!());
251+
/// ```rust,no_run
252+
/// use snowflake_app_lib::devmonitor::SpanGuard;
253+
/// use tauri::AppHandle;
254+
///
255+
/// fn example(app: &AppHandle) {
256+
/// let _span = SpanGuard::new(app, "read_file", module_path!());
241257
/// // ... do work ...
242258
/// } // Span automatically exits here with duration
243259
/// ```
@@ -346,8 +362,11 @@ impl Drop for SpanGuard {
346362
///
347363
/// # Example
348364
///
349-
/// ```rust
350-
/// {
365+
/// ```rust,no_run
366+
/// use snowflake_app_lib::span;
367+
/// use tauri::AppHandle;
368+
///
369+
/// fn example(app: &AppHandle) {
351370
/// let _span = span!(app, "read_file");
352371
/// // ... do work ...
353372
/// } // Span automatically exits here

0 commit comments

Comments
 (0)