Skip to content

Comments

feat: push_str capacity exceeds error message#2

Merged
tindzk merged 2 commits intotindzk:mainfrom
hlsxx:pr/capacity-exceeds
Nov 20, 2025
Merged

feat: push_str capacity exceeds error message#2
tindzk merged 2 commits intotindzk:mainfrom
hlsxx:pr/capacity-exceeds

Conversation

@hlsxx
Copy link
Contributor

@hlsxx hlsxx commented Nov 15, 2025

First off, great work on the library! The source code is very clean and nicely structured :)

I improved ExceedsCapacity error message clarity. I made a small change to improve the ExceedsCapacity error message, which was a bit confusing in its current form.

In current state:

let mut x = qstr::BStr7::new();
x.push_str("Hello world").unwrap();

Error message: String length (0) exceeds capacity (7)

This may be misleading because it shows the current string length (0) instead of the total length that the operation should result in (11). (In my opinion)

After this change
Error message: String length (11) exceeds capacity (7)

The error now displays the total resulting length (current length + new string length) instead of just the initial value.

@tindzk
Copy link
Owner

tindzk commented Nov 19, 2025

Thanks for the contribution!

Could you please add a test for this change in src/tests/bounded_str_tests.rs?

@tindzk tindzk merged commit 55a2ee1 into tindzk:main Nov 20, 2025
1 check passed
@tindzk
Copy link
Owner

tindzk commented Nov 20, 2025

Thanks! I released v0.1.2 with this fix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants