148 Commits

Author SHA1 Message Date
David Faure
3be2b2aaa5 internal: fix gdb pretty printer when using Repr::Static
I missed a ["__0"] to access the str in the Static case.

Also, simplify the code to rely on the pretty printer for str
rather than accessing data_ptr/length directly. This makes it
more robust against changes in str.

Output before: "<SmolStr Static error: There is no member named data_ptr.>"
Output after: "preferred-width"
2025-11-30 10:35:07 +01:00
Laurențiu Nicola
ef944f193f Reformat python script 2025-11-24 13:07:39 +02:00
David Faure
0e24a86d36 Provide a gdb pretty printer for smol_str::SmolStr
Auto-loaded via the debugger_visualizer attribute.
Tested on smolstr's unittest:

$ RUSTFLAGS="-C debuginfo=2 -C opt-level=0" cargo test -p smol_str --no-run
$ rust-gdb target/debug/deps/test-a806b111557a7133
(gdb) break test::conversions
(gdb) run
(gdb) next
(gdb) print s
(and other locations in that file, to test the three cases: Inline,
Static and Heap)
2025-11-23 14:49:23 +01:00
Alex Butler
d52491b520 smol_str: Optimise inline SmolStr::clone 2025-11-18 11:41:54 +00:00
Chayim Refael Friedman
c8265198ef Merge pull request #21021 from A4-Tacks/lib-smol_str-doc-feature
Fix removed feature `doc_auto_cfg` for smol_str lib
2025-11-15 09:17:33 +02:00
Lukas Wirth
1b62ceb886 Merge pull request #21002 from Veykril/veykril/push-nztxvpnntmrx
lib: Bump editions to 2024 and remove legacy files
2025-11-15 09:17:16 +02:00
Lukas Wirth
51e915cff1 Reformat 2025-11-15 09:16:57 +02:00
Lukas Wirth
9295f8eaf6 Update Cargo.toml and lockfile 2025-11-15 09:16:57 +02:00
Lukas Wirth
2fcccbbe29 Publish 0.3.4 2025-10-23 17:10:05 +02:00
Lukas Wirth
1af327e78a Publish 0.3.3 2025-10-23 13:15:25 +02:00
Alex Butler
b1acd45fce Update changelog 2025-10-22 14:29:46 +01:00
Alex Butler
6ca3f3812a Mark replacen_1_ascii as unsafe 2025-10-22 14:29:46 +01:00
Alex Butler
25cb3f6c56 Optimise replacen 1-ascii when count >= len 2025-10-22 14:29:46 +01:00
Alex Butler
a2b3d25dbf Optimise replacen_smolstr for single ascii replace 2025-10-22 14:29:46 +01:00
Alex Butler
b4ce6529fa Add test from_buf_and_chars_size_hinted_heap & fix 2025-10-22 14:25:23 +01:00
Alex Butler
c9cd0324a7 Update changelog 2025-10-22 14:25:23 +01:00
Alex Butler
bc69b02574 Optimise to_{lower,upper}case_smolstr 2025-10-22 14:25:23 +01:00
Alex Butler
eabb248294 CI: Add TEST_BENCHES 2025-10-22 09:41:47 +02:00
Alex Butler
2cb99fb418 Only bench smol_str stuff 2025-10-22 09:41:47 +02:00
Alex Butler
09ecb46094 Add SmolStr vs String benchmarks 2025-10-22 09:41:47 +02:00
Alex Butler
f8612bc596 Update changelog 2025-09-22 21:07:17 +02:00
Alex Butler
a267e0905e Optimise to_ascii_{upper,lower}case_smolstr 2025-09-22 21:07:17 +02:00
james7132
4cdc1b1544 Use serde_core over serde 2025-09-22 10:40:39 +02:00
Alex Butler
3e6863eeb1 Fix lints 2025-09-14 12:34:12 +01:00
Lukas Wirth
076e315d60 Publish 0.3.2 2024-10-23 22:56:02 +02:00
Lukas Wirth
037436ef16 Fix SmoLStrBuilder pushing null bytes on heap spill 2024-10-23 22:56:02 +02:00
Alex Butler
b5d68d17eb Update CHANGELOG.md
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2024-09-03 09:47:53 +01:00
Alex Butler
5ca72343dc Add 0.2.2 changelog & fix lints 2024-09-03 09:21:42 +01:00
Lukas Wirth
5e0ab10e12 Add CHANGELOG.md 2024-09-03 10:03:51 +02:00
Lukas Wirth
6db8eda235 Publish 0.3.1 2024-09-03 09:46:26 +02:00
Lukas Wirth
4c0d45e59b Make SmolStrBuilder fields private 2024-09-03 09:46:26 +02:00
Lukas Wirth
e172e4ee25 Publish 0.3.0 2024-09-03 09:31:16 +02:00
Lukas Wirth
6216c05690 SmolStrBuilder::push 2024-09-03 09:28:34 +02:00
Lukas Wirth
cf33d6ddb5 Drop unstable__schema 2024-09-03 09:19:17 +02:00
Corvin Paul
bf431789d3 Add support for borsh 2024-09-03 09:19:17 +02:00
Lukas Wirth
aa63570498 Expose SmolStrBuilder 2024-09-03 09:14:56 +02:00
Lukas Wirth
a2163274c4 Add more trait impls 2024-09-03 07:51:17 +02:00
Lukas Wirth
6b0d9ffdb5 Various cleanups 2024-09-03 07:51:17 +02:00
Lukas Wirth
28b9403e15 Bump deps 2024-09-02 20:42:14 +02:00
Rob Ede
c1327b21ba Migrate CI to actions-rust-lang/setup-rust-toolchain 2024-06-01 10:06:49 +02:00
Rob Ede
5146c928fd Document crate feature guards 2024-06-01 10:06:30 +02:00
Lukas Wirth
7cb89f14c6 Publish 0.2.2 2024-05-14 10:15:12 +02:00
Lukas Wirth
89a555b9b5 Document unsafe blocks 2024-05-14 10:09:33 +02:00
Alex Butler
860343ab85 Add StrExt::replace_smolstr, replacen_smolstr 2024-04-18 10:08:01 +02:00
Arpad Borsos
29f5ba6318 Add PartialEq shortcut for ptr_eq strings
This first compares the `Repr` before falling back to actually comparing the raw `as_str` itself.
In some micro-benchmarks, this speeds up inline and heap string comparisons when equal by ~70%.

There is a tiny hit in the non-equal case however. It is also noteworthy that the assembly generated for `Repr` is horrible,
and looks like its above the inlining threshold now.
2024-02-08 22:42:21 +01:00
Alex Butler
da4eb11ce9 Add must_use to StrExt methods 2024-02-08 22:41:25 +01:00
Alex Butler
79bb5e39b5 Add StrExt, to_lowercase_smolstr & friends 2024-02-08 14:43:17 +01:00
Anton Sol
2235939297 reformat 2024-01-31 18:59:27 +01:00
Anton Sol
257ece4d73 remove nightly benchmark feature 2024-01-31 18:59:27 +01:00
Anton Sol
1f338f7d8c Manually impl clone 2024-01-31 18:59:27 +01:00