113 Commits

Author SHA1 Message Date
Scott Driggers
ced7e87db1 Implementing From<Arc<str>> for SmolStr and From<SmolStr> for Arc<str>
Also adding one test to verify
2023-08-25 09:39:14 -04:00
Lukas Wirth
b04898eb32 Merge pull request rust-analyzer/smol_str#55 from rust-analyzer/as-ref 2023-04-11 14:09:31 +02:00
Lukas Wirth
ea478f81f1 Release 0.2.0 2023-03-31 07:38:34 +02:00
Lukas Wirth
4ad02f720f Clarify size of SmolStr better 2023-03-31 07:37:08 +02:00
Lukas Wirth
8f9fefd8a0 Implement AsRef<str> in favor of generic From impls 2023-03-31 07:33:19 +02:00
Lukas Wirth
fef9abc8f1 Merge pull request rust-analyzer/smol_str#54 from rust-analyzer/opt-dep-feat 2023-03-30 17:37:45 +02:00
Lukas Wirth
ae67412164 Use optional dependency feature syntax to make serde actually optional 2023-03-30 17:36:41 +02:00
Lukas Wirth
3dc956388e Merge pull request rust-analyzer/smol_str#53 from Austaras/master
Closes https://github.com/rust-analyzer/smol_str/issues/45
2023-02-05 08:18:37 +01:00
austaras
5f367d76ae Update test 2023-02-05 08:15:53 +08:00
austaras
46e5bd0097 Remove redundant enum value 2023-01-24 18:03:45 +08:00
austaras
8eced95f00 Update README.MD 2023-01-23 21:19:58 +08:00
austaras
ec90e593f3 0.1.24 2023-01-23 18:57:29 +08:00
austaras
c5a4d2475e One more byte for inlined 2023-01-23 18:06:21 +08:00
Lukas Wirth
25d7fa7105 Revert usage of optional dependency feature syntax 2022-04-26 23:59:49 +02:00
bors[bot]
dc5a62b1ef Merge rust-analyzer/smol_str#46
46: Use new optional dependency feature syntax making serde truly optional r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/smol_str/issues/42
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-08 19:05:48 +00:00
Lukas Wirth
844ee7798d Use new optional dependency feature syntax making serde truly optional 2022-04-08 21:05:25 +02:00
bors[bot]
97445cc17f Merge rust-analyzer/smol_str#44
44: Bump dependencies r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-03 14:19:42 +00:00
Lukas Wirth
fa9d3154e9 Bump dependencies 2022-04-03 16:19:14 +02:00
bors[bot]
d025e36945 Merge rust-analyzer/smol_str#43
43: Clarify what `WS` is r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/smol_str/issues/17
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-03 14:10:31 +00:00
Lukas Wirth
a956245171 Clarify what WS is 2022-04-03 16:10:03 +02:00
bors[bot]
0b808e8a37 Merge rust-analyzer/smol_str#18
18: Add fmt tidy test r=Veykril a=Atul9



Co-authored-by: Atul Bhosale <atul1bhosale@gmail.com>
2022-04-03 14:06:06 +00:00
bors[bot]
a898cf57a7 Merge rust-analyzer/smol_str#21
21: Add a new test for a bad size hint r=bjorn3 a=Dr-Emann

Changes in PR rust-analyzer/smol_str#20 allow for an incorrect size hint to create a non-canonical SmolStr. Add a new test which will fail if we ever rely on
SmolStrs to be canonical when comparing for equality.

Co-authored-by: Zachary Dremann <dremann@gmail.com>
2022-03-11 06:30:54 +00:00
Zachary Dremann
77c6c2b2ae Use ASCII to get the "too big" char iterator
Additionally, make the construction of the string mechanical
2022-03-10 19:29:45 -05:00
Zachary Dremann
a1cbd1feee Add a new test for bad size hint
Changes in PR rust-analyzer/smol_str#20 allow for an incorrect size hint to create a
non-canonical SmolStr. Add a new test which will fail if we ever rely on
SmolStrs to be canonical when comparing for equality.
2022-03-10 19:29:45 -05:00
bors[bot]
5fb30ef6ac Merge rust-analyzer/smol_str#41
41: Remove unnecessary `Into<String>` bound from `From<T>` impl r=Veykril a=Veykril

Looks like this was forgotten when the bound got removed from the `new` constructor

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-04 18:11:13 +00:00
Lukas Wirth
7771472941 Remove unnecessary Into<String> bound from From<T> impl 2021-11-04 18:43:01 +01:00
bors[bot]
4916033264 Merge rust-analyzer/smol_str#40
40: fix no_std support r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-11-01 13:05:10 +00:00
Aleksey Kladov
661ca5b452 fix no_std support 2021-11-01 16:04:40 +03:00
bors[bot]
e8e56d3bb6 Merge rust-analyzer/smol_str#39
39: implement FromStr r=matklad a=matklad

closes rust-analyzer/smol_str#31

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-11-01 11:34:01 +00:00
Aleksey Kladov
14baf0779d implement FromStr
closes rust-analyzer/smol_str#31
2021-11-01 14:33:22 +03:00
bors[bot]
b40a53f163 Merge rust-analyzer/smol_str#26
26: Update CI badge in readme to point to Github Actions r=bjorn3 a=ComputerDruid

The Travis workflow was deleted in 3d5b7e3476f91280aedda3900c13838b00d64a9d

Co-authored-by: Daniel Johnson <ComputerDruid@gmail.com>
2021-09-13 12:37:26 +00:00
bors[bot]
eea27bc146 Merge rust-analyzer/smol_str#36
36: Add `#![no_std]` support r=matklad a=ark0f



Co-authored-by: Arsenii Lyashenko <arsenylyashenko.3@gmail.com>
2021-08-12 12:32:32 +00:00
Arsenii Lyashenko
d5bf6c8dab Add #![no_std] support 2021-08-12 15:00:02 +03:00
bors[bot]
5ac630172b Merge rust-analyzer/smol_str#35
35: Implement arbitrary behind a feature flag r=matklad a=jeffa5

Fixes rust-analyzer/smol_str#34 

Co-authored-by: Andrew Jeffery <dev@jeffas.io>
2021-06-26 15:34:48 +00:00
Andrew Jeffery
cfe22778a1 Implement arbitrary behind a feature flag 2021-06-26 09:27:09 +01:00
Daniel Johnson
1f5f91a64d Update CI badge in readme to point to Github Actions
The Travis workflow was deleted in 3d5b7e3476f91280aedda3900c13838b00d64a9d
2020-10-06 19:43:15 -07:00
Aleksey Kladov
4966a00ca0 Document MSRV 2020-09-21 17:15:32 +02:00
bors[bot]
5eec7d62d5 Merge rust-analyzer/smol_str#23
23: modernize r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-20 08:16:49 +00:00
Aleksey Kladov
4ff9ad2b27 Drop benchmarking
I don't really look at the results of the benchmarks anyway, so having
them in the repo creates a false sense of benchmarkdness.

If I get to implementing proper benchmarking, I'd probably stay away
from criterion -- we need something much much simpler for this crate.
2020-09-20 09:59:31 +02:00
Aleksey Kladov
6c8f7ce3cc Bump major version 2020-09-20 09:58:53 +02:00
Aleksey Kladov
3d5b7e3476 Switch CI to actions 2020-09-20 09:54:54 +02:00
Aleksey Kladov
e412a0199f ⬆️ proptest 2020-09-20 09:49:57 +02:00
Aleksey Kladov
d40b0bc1b5 Add new_inline const-fn constructor 2020-09-20 09:45:06 +02:00
Atul Bhosale
667c63685d Add fmt tidy test 2020-07-07 21:17:33 +05:30
Aleksey Kladov
4c64e2026c Merge pull request rust-analyzer/smol_str#19 from Dr-Emann/limit_substr_check
Avoid checking long strings for matching against whitespace
2020-07-07 11:21:42 +02:00
Aleksey Kladov
3109a27b1f Merge pull request rust-analyzer/smol_str#20 from Dr-Emann/less_monomorph
Avoid possible extra monomorphization
2020-07-07 11:21:31 +02:00
Zachary Dremann
2b15d9c1f5 Use the number of remaining elements in the char iter for allocation
When collecting from an iterator of chars, when expanding past
INLINE_CAP, include extra space for at least one byte per char for any
remaining known size.
2020-07-06 18:35:14 -04:00
Zachary Dremann
1fea4a5b2a Avoid possible extra monomorphization
By pulling `from_char_iter<I: Iterator>()` into a function, we can avoid
multiple monomorphizations of `FromIterator` when multiple
`IntoIterator`s result in the same iterator type.
2020-07-06 18:32:12 -04:00
Zachary Dremann
d97525eb5e Avoid checking long strings for matching against whitespace
Previously, the string was checked for starting with newlines and ending
with spaces, then ensuring that the length of those substrings were
short enough to use our constant. Instead, only do the check for as many
items as we have in the WS constant.

In the worst case, this avoids an O(n) check if the input is a long
string of `\n`, possibly followed by a long string of spaces.
2020-07-06 16:07:29 -04:00
Zachary Dremann
1235f1c11a Rustfmt 2020-07-06 13:12:41 -04:00