We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a0bd198 commit b3bc0d8Copy full SHA for b3bc0d8
examples/fmt_to_string_std.rs
@@ -0,0 +1,25 @@
1
+use color_backtrace::BacktracePrinter;
2
+
3
+fn main() -> Result<(), std::io::Error> {
4
+ // Start your trace
5
+ let trace = std::backtrace::Backtrace::force_capture();
6
7
+ // Do stuff...
8
9
+ // And print!
10
+ let bt = color_backtrace::btparse::deserialize(&trace).unwrap();
11
+ let printer = BacktracePrinter::default();
12
+ let str = printer.format_trace_to_string(&bt)?;
13
14
+ if cfg!(windows) {
15
+ println!(
16
+ "Warning: on Windows, you'll have to enable VT100 \
17
+ printing for your app in order for this to work \
18
+ correctly. This example doesn't do this."
19
+ );
20
+ }
21
22
+ println!("{}", str);
23
24
+ Ok(())
25
+}
0 commit comments