Skip to content

Commit

Permalink
Merge rust-bitcoin#3821: api: Include generics in regex
Browse files Browse the repository at this point in the history
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
  • Loading branch information
apoelstra committed Dec 30, 2024
2 parents 7497c28 + 7f2cf1d commit 4cd7a5e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contrib/api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4cd7a5e

Please sign in to comment.