@@ -12,6 +12,11 @@ use {resolve, resolve_frame, trace, Symbol, SymbolName};
12
12
///
13
13
/// `Backtrace` supports pretty-printing of backtraces through its `Debug`
14
14
/// implementation.
15
+ ///
16
+ /// # Required features
17
+ ///
18
+ /// This function requires the `std` feature of the `backtrace` crate to be
19
+ /// enabled, and the `std` feature is enabled by default.
15
20
#[ derive( Clone ) ]
16
21
#[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
17
22
#[ cfg_attr( feature = "serialize-serde" , derive( Deserialize , Serialize ) ) ]
@@ -32,6 +37,11 @@ fn _assert_send_sync() {
32
37
///
33
38
/// This type is returned as a list from `Backtrace::frames` and represents one
34
39
/// stack frame in a captured backtrace.
40
+ ///
41
+ /// # Required features
42
+ ///
43
+ /// This function requires the `std` feature of the `backtrace` crate to be
44
+ /// enabled, and the `std` feature is enabled by default.
35
45
#[ derive( Clone ) ]
36
46
pub struct BacktraceFrame {
37
47
frame : Frame ,
@@ -65,6 +75,11 @@ impl Frame {
65
75
///
66
76
/// This type is returned as a list from `BacktraceFrame::symbols` and
67
77
/// represents the metadata for a symbol in a backtrace.
78
+ ///
79
+ /// # Required features
80
+ ///
81
+ /// This function requires the `std` feature of the `backtrace` crate to be
82
+ /// enabled, and the `std` feature is enabled by default.
68
83
#[ derive( Clone ) ]
69
84
#[ cfg_attr( feature = "serialize-rustc" , derive( RustcDecodable , RustcEncodable ) ) ]
70
85
#[ cfg_attr( feature = "serialize-serde" , derive( Deserialize , Serialize ) ) ]
@@ -91,6 +106,11 @@ impl Backtrace {
91
106
///
92
107
/// let current_backtrace = Backtrace::new();
93
108
/// ```
109
+ ///
110
+ /// # Required features
111
+ ///
112
+ /// This function requires the `std` feature of the `backtrace` crate to be
113
+ /// enabled, and the `std` feature is enabled by default.
94
114
#[ inline( never) ] // want to make sure there's a frame here to remove
95
115
pub fn new ( ) -> Backtrace {
96
116
let _guard = lock_and_platform_init ( ) ;
@@ -117,6 +137,11 @@ impl Backtrace {
117
137
/// current_backtrace.resolve();
118
138
/// println!("{:?}", current_backtrace); // symbol names now present
119
139
/// ```
140
+ ///
141
+ /// # Required features
142
+ ///
143
+ /// This function requires the `std` feature of the `backtrace` crate to be
144
+ /// enabled, and the `std` feature is enabled by default.
120
145
#[ inline( never) ] // want to make sure there's a frame here to remove
121
146
pub fn new_unresolved ( ) -> Backtrace {
122
147
let _guard = lock_and_platform_init ( ) ;
@@ -157,6 +182,11 @@ impl Backtrace {
157
182
/// The first entry of this slice is likely the function `Backtrace::new`,
158
183
/// and the last frame is likely something about how this thread or the main
159
184
/// function started.
185
+ ///
186
+ /// # Required features
187
+ ///
188
+ /// This function requires the `std` feature of the `backtrace` crate to be
189
+ /// enabled, and the `std` feature is enabled by default.
160
190
pub fn frames ( & self ) -> & [ BacktraceFrame ] {
161
191
& self . frames [ self . actual_start_index ..]
162
192
}
@@ -166,6 +196,11 @@ impl Backtrace {
166
196
///
167
197
/// If this backtrace has been previously resolved or was created through
168
198
/// `new`, this function does nothing.
199
+ ///
200
+ /// # Required features
201
+ ///
202
+ /// This function requires the `std` feature of the `backtrace` crate to be
203
+ /// enabled, and the `std` feature is enabled by default.
169
204
pub fn resolve ( & mut self ) {
170
205
let _guard = lock_and_platform_init ( ) ;
171
206
for frame in self . frames . iter_mut ( ) . filter ( |f| f. symbols . is_none ( ) ) {
@@ -208,11 +243,21 @@ impl Into<Vec<BacktraceFrame>> for Backtrace {
208
243
209
244
impl BacktraceFrame {
210
245
/// Same as `Frame::ip`
246
+ ///
247
+ /// # Required features
248
+ ///
249
+ /// This function requires the `std` feature of the `backtrace` crate to be
250
+ /// enabled, and the `std` feature is enabled by default.
211
251
pub fn ip ( & self ) -> * mut c_void {
212
252
self . frame . ip ( ) as * mut c_void
213
253
}
214
254
215
255
/// Same as `Frame::symbol_address`
256
+ ///
257
+ /// # Required features
258
+ ///
259
+ /// This function requires the `std` feature of the `backtrace` crate to be
260
+ /// enabled, and the `std` feature is enabled by default.
216
261
pub fn symbol_address ( & self ) -> * mut c_void {
217
262
self . frame . symbol_address ( ) as * mut c_void
218
263
}
@@ -226,28 +271,53 @@ impl BacktraceFrame {
226
271
///
227
272
/// Note that if this frame came from an unresolved backtrace then this will
228
273
/// return an empty list.
274
+ ///
275
+ /// # Required features
276
+ ///
277
+ /// This function requires the `std` feature of the `backtrace` crate to be
278
+ /// enabled, and the `std` feature is enabled by default.
229
279
pub fn symbols ( & self ) -> & [ BacktraceSymbol ] {
230
280
self . symbols . as_ref ( ) . map ( |s| & s[ ..] ) . unwrap_or ( & [ ] )
231
281
}
232
282
}
233
283
234
284
impl BacktraceSymbol {
235
285
/// Same as `Symbol::name`
286
+ ///
287
+ /// # Required features
288
+ ///
289
+ /// This function requires the `std` feature of the `backtrace` crate to be
290
+ /// enabled, and the `std` feature is enabled by default.
236
291
pub fn name ( & self ) -> Option < SymbolName > {
237
292
self . name . as_ref ( ) . map ( |s| SymbolName :: new ( s) )
238
293
}
239
294
240
295
/// Same as `Symbol::addr`
296
+ ///
297
+ /// # Required features
298
+ ///
299
+ /// This function requires the `std` feature of the `backtrace` crate to be
300
+ /// enabled, and the `std` feature is enabled by default.
241
301
pub fn addr ( & self ) -> Option < * mut c_void > {
242
302
self . addr . map ( |s| s as * mut c_void )
243
303
}
244
304
245
305
/// Same as `Symbol::filename`
306
+ ///
307
+ /// # Required features
308
+ ///
309
+ /// This function requires the `std` feature of the `backtrace` crate to be
310
+ /// enabled, and the `std` feature is enabled by default.
246
311
pub fn filename ( & self ) -> Option < & Path > {
247
312
self . filename . as_ref ( ) . map ( |p| & * * p)
248
313
}
249
314
250
315
/// Same as `Symbol::lineno`
316
+ ///
317
+ /// # Required features
318
+ ///
319
+ /// This function requires the `std` feature of the `backtrace` crate to be
320
+ /// enabled, and the `std` feature is enabled by default.
251
321
pub fn lineno ( & self ) -> Option < u32 > {
252
322
self . lineno
253
323
}
0 commit comments