Skip to content

Commit 4cd7a5e

Browse files
committed
Merge rust-bitcoin#3821: api: Include generics in regex
7f2cf1d api: Include generics in regex (Tobin C. Harding) Pull request description: The regex is still wrong, it misses structs with generics. Currently `contrib/api.sh io types` returns: ErrorKind Error Sink But with this patch applied it returns: FromStd<T> ToStd<T> ErrorKind Cursor<T> Error Sink Take<'a, R: bitcoin_io::Read + ?core::marker::Sized> Thanks ChatGPT, good robot. ACKs for top commit: storopoli: ACK 7f2cf1d apoelstra: ACK 7f2cf1d; successfully ran local tests; nice! Tree-SHA512: 92fde9788edf8bf3e9b0639aec0aa0c4d7509c46cb048505e8018af57d671e893dccb7e0e018246438cceeb9c64232b8a0639bfe1ee7a35983b9e2bf1f2d4a4a
2 parents 7497c28 + 7f2cf1d commit 4cd7a5e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

contrib/api.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ main() {
9999

100100
# Print all public structs and enums.
101101
structs_and_enums() {
102-
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://"
102+
grep -oP 'pub (struct|enum) \K[\w:]+(?:<[^>]+>)?(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://"
103103
}
104104

105105
# Print all public structs and enums excluding error types.
106106
structs_and_enums_no_err() {
107-
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
107+
grep -oP 'pub (struct|enum) \K[\w:]+(?:<[^>]+>)?(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
108108
}
109109

110110
# Print all public traits.

0 commit comments

Comments
 (0)