|
7 | 7 |
|
8 | 8 | //! Allocator-safe formatting and assertion macros. |
9 | 9 | //! |
10 | | -//! `alloc-fmt` provides formatting and assertion macros similar to the standard library's |
| 10 | +//! [`alloc-fmt`] provides formatting and assertion macros similar to the standard library's |
11 | 11 | //! [`println`], [`eprintln`], [`panic`], [`assert`], [`debug_assert`], etc which are safe for use in a |
12 | 12 | //! global allocator. The standard library's formatting and assertion macros can allocate, meaning |
13 | 13 | //! that if they are used in the implementation of a global allocator, it can cause infinite |
14 | 14 | //! recursion. The macros in this crate avoid this problem by either not allocating (in the case of |
15 | 15 | //! formatting macros) or detecting recursion (in the case of panic and assertion macros). |
16 | 16 | //! |
17 | | -//! [`println`]: ../std/macro.println.html |
18 | | -//! [`eprintln`]: ../std/macro.eprint.html |
19 | | -//! [`panic`]: ../std/macro.panic.html |
20 | | -//! [`assert`]: ../std/macro.assert.html |
21 | | -//! [`debug_assert`]: ../std/macro.debug_assert.html |
| 17 | +//! [`alloc-fmt`]: index.html |
| 18 | +//! [`println`]: https://doc.rust-lang.org/std/macro.println.html |
| 19 | +//! [`eprintln`]: https://doc.rust-lang.org/std/macro.eprint.html |
| 20 | +//! [`panic`]: https://doc.rust-lang.org/std/macro.panic.html |
| 21 | +//! [`assert`]: https://doc.rust-lang.org/std/macro.assert.html |
| 22 | +//! [`debug_assert`]: https://doc.rust-lang.org/std/macro.debug_assert.html |
22 | 23 | //! |
23 | 24 | //! # Usage and Behavior |
24 | 25 | //! The macros in this crate are named `alloc_xxx`, where `xxx` is the name of the equivalent |
|
36 | 37 | //! Unlike the standard library assertion and panic macros, the stack is not unwound, and once an |
37 | 38 | //! assertion failure or panic triggers, it cannot be caught or aborted. |
38 | 39 | //! |
39 | | -//! [`alloc_println`]: /macro.alloc_println.html |
40 | | -//! [`alloc_debug_assert`]: /macro.alloc_debug_assert.html |
| 40 | +//! [`alloc_println`]: macro.alloc_println.html |
| 41 | +//! [`alloc_debug_assert`]: macro.alloc_debug_assert.html |
41 | 42 |
|
42 | 43 | #![no_std] |
43 | 44 | #![feature(core_intrinsics)] |
@@ -286,9 +287,13 @@ macro_rules! alloc_debug_assert_ne { |
286 | 287 |
|
287 | 288 | /// Types that can be unwrapped in an allocation-safe manner. |
288 | 289 | /// |
289 | | -/// `AllocUnwrap` provides the `alloc_unwrap` and `alloc_expect` methods, which are allocation-safe |
290 | | -/// equivalents of the `unwrap` and `expect` methods on `Option` and `Result`. `AllocUnwrap` is |
291 | | -/// implemented for `Option` and `Result`. |
| 290 | +/// [`AllocUnwrap`] provides the [`alloc_unwrap`] and [`alloc_expect`] methods, which are allocation-safe |
| 291 | +/// equivalents of the [`unwrap`][Option::unwrap] and [`expect`][Option::expect] methods on [`Option`] and [`Result`]. [`AllocUnwrap`] is |
| 292 | +/// implemented for [`Option`] and [`Result`]. |
| 293 | +/// |
| 294 | +/// [`AllocUnwrap`]: trait.AllocUnwrap.html |
| 295 | +/// [`alloc_unwrap`]: trait.AllocUnwrap.html#tymethod.alloc_unwrap |
| 296 | +/// [`alloc_expect`]: trait.AllocUnwrap.html#tymethod.alloc_expect |
292 | 297 | /// |
293 | 298 | /// # Examples |
294 | 299 | /// |
|
0 commit comments