1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// devela::code::util::debug
//
//! Defines [`compile_warn!`], [`fn_name`].
//
/// Emits a compile-time warning with a provided message.
///
/// This implemented through an existing `dead_code` warning,
/// thus the output for the following example:
///
/// ```
/// # use devela::compile_warn;
/// compile_warn!(sample_user_defined_warning);
/// ```
///
/// may look as follows:
/// ```text
/// warning: constant `user_defined_warning` is never used
/// --> src/lib.rs:7:9
/// |
/// 7 | compile_warn!(user_defined_warning);
/// | ^^^^^^^^^^^^^^^^^^^^
/// ```
///
/// Once [`proc_macro_diagnostics`] feature is stabilized, this macro
/// could be replaced with a proper proc-macro-based implementation.
///
/// This macro is intended to be used in the development process, as an alternative
/// to the [`unimplemented`] macro which doesn't cause code to panic.
///
/// [`std::compile_error`]: https://doc.rust-lang.org/std/macro.compile_error.html
/// [`proc_macro_diagnostics`]: https://github.com/rust-lang/rust/issues/54140
/// [`unimplemented`]: https://doc.rust-lang.org/std/macro.unimplemented.html
pub use compile_warn;
/// This macro returns the name of the enclosing function.
///
/// As the internal implementation is based on [`type_name`],
/// this macro derives all the limitations of this function.
///
/// ## Examples
/// ```
/// mod bar {
/// pub fn sample_function() {
/// # use devela::fn_name;
/// assert!(fn_name!().ends_with("bar::sample_function"));
/// }
/// }
/// bar::sample_function();
/// ```
pub use fn_name;