bitcoin_internals/
error.rs1pub mod input_string;
9mod parse_error;
10
11pub use input_string::InputString;
12
13#[macro_export]
19macro_rules! write_err {
20 ($writer:expr, $string:literal $(, $args:expr)*; $source:expr) => {
21 {
22 #[cfg(feature = "std")]
23 {
24 let _ = &$source; write!($writer, $string $(, $args)*)
26 }
27 #[cfg(not(feature = "std"))]
28 {
29 write!($writer, concat!($string, ": {}") $(, $args)*, $source)
30 }
31 }
32 }
33}
34
35#[macro_export]
38macro_rules! impl_std_error {
39 ($type:ty) => {
41 #[cfg(feature = "std")]
42 impl std::error::Error for $type {}
43 };
44 ($type:ty, $field:ident) => {
46 #[cfg(feature = "std")]
47 impl std::error::Error for $type {
48 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.$field) }
49 }
50 };
51}