1
+ #[ cfg( feature = "serde" ) ]
2
+ use crate :: resolve;
1
3
use crate :: PrintFmt ;
2
- use crate :: { resolve , resolve_frame, trace, BacktraceFmt , Symbol , SymbolName } ;
4
+ use crate :: { resolve_frame, trace, BacktraceFmt , Symbol , SymbolName } ;
3
5
use std:: ffi:: c_void;
4
6
use std:: fmt;
5
7
use std:: path:: { Path , PathBuf } ;
@@ -50,7 +52,7 @@ pub struct BacktraceFrame {
50
52
#[ derive( Clone ) ]
51
53
enum Frame {
52
54
Raw ( crate :: Frame ) ,
53
- #[ allow ( dead_code ) ]
55
+ #[ cfg ( feature = "serde" ) ]
54
56
Deserialized {
55
57
ip : usize ,
56
58
symbol_address : usize ,
@@ -62,20 +64,23 @@ impl Frame {
62
64
fn ip ( & self ) -> * mut c_void {
63
65
match * self {
64
66
Frame :: Raw ( ref f) => f. ip ( ) ,
67
+ #[ cfg( feature = "serde" ) ]
65
68
Frame :: Deserialized { ip, .. } => ip as * mut c_void ,
66
69
}
67
70
}
68
71
69
72
fn symbol_address ( & self ) -> * mut c_void {
70
73
match * self {
71
74
Frame :: Raw ( ref f) => f. symbol_address ( ) ,
75
+ #[ cfg( feature = "serde" ) ]
72
76
Frame :: Deserialized { symbol_address, .. } => symbol_address as * mut c_void ,
73
77
}
74
78
}
75
79
76
80
fn module_base_address ( & self ) -> Option < * mut c_void > {
77
81
match * self {
78
82
Frame :: Raw ( ref f) => f. module_base_address ( ) ,
83
+ #[ cfg( feature = "serde" ) ]
79
84
Frame :: Deserialized {
80
85
module_base_address,
81
86
..
@@ -97,6 +102,7 @@ impl Frame {
97
102
} ;
98
103
match * self {
99
104
Frame :: Raw ( ref f) => resolve_frame ( f, sym) ,
105
+ #[ cfg( feature = "serde" ) ]
100
106
Frame :: Deserialized { ip, .. } => {
101
107
resolve ( ip as * mut c_void , sym) ;
102
108
}
0 commit comments