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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/// A macro that implements the `From` trait for converting from one error type
/// to another.
///
/// # Usage
/// ```
/// # use std::{io,fmt};
///
/// use umya_spreadsheet::from_err;
///
/// #[derive(Debug)]
/// enum MyError {
/// Io(std::io::Error),
/// };
/// # impl fmt::Display for MyError {
/// # fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// # unimplemented!()
/// # }
/// # }
/// # impl std::error::Error for MyError {}
///
/// from_err!(std::io::Error, MyError, Io);
///
/// let io_err = io::Error::new(io::ErrorKind::Other, "An I/O error occurred");
/// let my_err: MyError = io_err.into();
/// ```
/// Asserts that the SHA-256 hash of a given input matches the expected
/// hexadecimal string.
///
/// # Arguments
///
/// * `$input` - The input data to hash.
/// * `$expected_hex` - The expected SHA-256 hash as a hexadecimal string.
///
/// # Panics
///
/// This macro will panic if the actual SHA-256 hash does not match the
/// expected hash.
///
/// # Examples
///
/// ```ignore
/// let data = b"Hello, world!";
/// assert_sha256!(
/// data,
/// "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e"
/// );
/// // This will not panic
///
/// assert_sha256!(data, "invalid_hash");
/// // This will panic with a message indicating the mismatch
/// ```
/// A macro that compiles a regular expression and caches it.
///
/// # Usage
/// ```rust,ignore
/// // Unable to run because function is private
/// let re = compile_regex!(r"^\d+$");
///
/// assert!(re.is_match("123").unwrap());
/// assert!(!re.is_match("abc").unwrap());
/// ```
/// Prints a byte slice as a hex string, prefixed with the variable name.
///
/// This macro takes a reference to a byte slice (`&[u8]`) and prints both
/// the variable name and its hexadecimal representation to stdout.
/// Prints the SHA-256 hash of a given input as a hexadecimal string.
///
/// # Examples
///
/// ```ignore
/// let data = b"Hello, world!";
/// print_sha256_hex!(data);
/// // Output: SHA256(data) = 5eb63bbbe01eeed093cb22bb8f5acdc3
/// ```
pub use assert_sha256;
pub use compile_regex;
pub use print_hex;
pub use print_sha256_hex;