api: Include generics in regex

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>
This commit is contained in:
Tobin C. Harding 2024-12-29 09:01:27 +11:00
parent 39dedf42d4
commit 7f2cf1dce8
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -99,12 +99,12 @@ main() {
# Print all public structs and enums.
structs_and_enums() {
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://"
grep -oP 'pub (struct|enum) \K[\w:]+(?:<[^>]+>)?(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://"
}
# Print all public structs and enums excluding error types.
structs_and_enums_no_err() {
grep -oP 'pub (struct|enum) \K[\w:]+(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
grep -oP 'pub (struct|enum) \K[\w:]+(?:<[^>]+>)?(?=\(|;| |$)' "$file" | sed "s/^${crate_full_name}:://" | grep -v Error
}
# Print all public traits.