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
/// Helper macro, which attaches an error to a given span.
pub use err;
// Uncomment this as soon as proc_macro_diagnostic land in stable.
//
//#![feature(proc_macro_diagnostic)]
///// Helper macro, which attaches an error to a given span.
//macro_rules! err {
// ($span:ident, $($text:expr),*) => {
// $span.span()
// .unwrap()
// .error(format!($($text,)*))
// .emit();
// }
//}
/// Helper macro, which takes a result.
/// Ok(T) => simply return the T
/// Err(err) => Emits an compiler error on the given span with the provided error message.
/// Also returns early with `None`.
/// `None` is used throughout this crate as a gracefull failure.
/// That way all code that can be created is being generated and the user sees all
/// errors without the macro code panicking.
pub use ok_or_err_return;