bitless/lib.rs
1//! A bit less code to carry with almost any program
2
3#![warn(clippy::all, missing_docs, nonstandard_style, future_incompatible)]
4
5pub mod error;
6pub mod journal;
7
8/// Returns the current function path, it could be used in `map_err` or `expect` to avoid typos
9#[macro_export]
10macro_rules! code_path {
11 () => {{
12 fn f() {}
13 fn type_name_of<T>(_: T) -> &'static str {
14 std::any::type_name::<T>()
15 }
16 let mut name = type_name_of(f);
17 name = &name[..name.len() - 3];
18 while name.ends_with("::{{closure}}") {
19 name = &name[..name.len() - 13];
20 }
21 name
22 }};
23}