Skip to content

base58: Add len and is_empty to Base58CkString#6526

Open
mpbagot wants to merge 2 commits into
rust-bitcoin:masterfrom
mpbagot:feature/base58-string-len
Open

base58: Add len and is_empty to Base58CkString#6526
mpbagot wants to merge 2 commits into
rust-bitcoin:masterfrom
mpbagot:feature/base58-string-len

Conversation

@mpbagot

@mpbagot mpbagot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

The Base58CkString type is essentially treated like a string in some cases. While users can cast to a &str with as_str, it is convenient to instead provide len and is_empty functions for the user.

Add len and is_empty methods to the Base58CkString type.

mpbagot added 2 commits July 13, 2026 16:05
The Base58CkString type is essentially treated like a string in some
cases. While users can cast to a &str with as_str, it is convenient to
instead provide len and is_empty functions for the user.

Add len and is_empty methods to the Base58CkString type.
With the new .len() function, the previous .as_str().len() use in the
address tests can now be shortened to a single .len() call instead.

Replace encoded.as_str().len() with encoded.len() in
base58_invalid_payload_length_reports_decoded_size test in address
module.
@github-actions github-actions Bot added C-bitcoin PRs modifying the bitcoin crate C-base58 PRs modifying the base58 crate labels Jul 13, 2026
@mpbagot mpbagot marked this pull request as ready for review July 13, 2026 06:40

@tcharding tcharding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3952e57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-base58 PRs modifying the base58 crate C-bitcoin PRs modifying the bitcoin crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants