Skip to content

Commit 7e3a4fc

Browse files
committed
Polish off the docs a bit pre-release.
1 parent 6e040d0 commit 7e3a4fc

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

CHANGELOG.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,28 @@ adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
1111

1212
- `smartstring` now implements its own boxed string type rather than deferring directly to
1313
`String`, so it no longer makes assumptions it shouldn't be making about the layout of the
14-
`String` struct. This also allows us to organise the boxed struct in a way that will let us rely
15-
only on our basic assumption that heap memory is word aligned on both big and little endian
16-
architectures. The most immediate consequence of this is that `smartstring` will now compile on
17-
32-bit big endian architectures such as `mips`.
14+
`String` struct.
15+
16+
This also allows us to organise the boxed struct in a way that will let us rely only on our
17+
basic assumption that heap memory is word aligned on both big and little endian architectures.
18+
The most immediate consequence of this is that `smartstring` will now compile on 32-bit big
19+
endian architectures such as `mips`.
20+
21+
We are now also explicitly allocating heap memory aligned for `u16` rather than `u8`, ensuring
22+
the assumption about pointer alignment becomes an invariant.
1823

1924
In short: `smartstring` no longer relies on undefined behaviour, and should be safe to use
2025
anywhere.
2126

2227
- The above means that the boxed `SmartString` is no longer pointer compatible with `String`, so
23-
if you were relying on that despite the documentation telling you not to, you'll really have to
28+
if you were relying on that despite the documentation urging you not to, you'll really have to
2429
stop it now. Converting between `SmartString` and `String` using `From` and `Into` traits is
2530
still efficient and allocation free.
2631

2732
- The minimum supported rustc version is now 1.57.0.
2833

34+
- The `smartstring::validate()` function has been removed, as it's no longer needed.
35+
2936
## [0.2.10] - 2022-02-20
3037

3138
### CHANGED

src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
//! and is generally a little faster, and [`Compact`], which is the same as
1111
//! [`LazyCompact`] except it will aggressively re-inline any expanded
1212
//! [`String`]s which become short enough to do so.
13-
//! [`LazyCompact`] is the default.
13+
//! [`LazyCompact`] is the default, and what you should be using unless
14+
//! you care considerably more about heap memory usage than performance.
1415
//!
1516
//! ## What Is It For?
1617
//!
@@ -47,7 +48,7 @@
4748
//! giving us 24 bytes (on 64-bit architectures) minus one bit to encode our
4849
//! inline string. It uses 23 bytes to store the string data and the remaining
4950
//! 7 bits to encode the string's length. When the available space is exceeded,
50-
//! it swaps itself out with a [`String`] containing its previous
51+
//! it swaps itself out with a boxed string type containing its previous
5152
//! contents. Likewise, if the string's length should drop below its inline
5253
//! capacity again, it deallocates the string and moves its contents inline.
5354
//!
@@ -90,8 +91,6 @@
9091
//! | [`proptest`](https://crates.io/crates/proptest) | A strategy for generating [`SmartString`]s from a regular expression. |
9192
//! | [`serde`](https://crates.io/crates/serde) | [`Serialize`][Serialize] and [`Deserialize`][Deserialize] implementations for [`SmartString`]. |
9293
//!
93-
//! [IntoString]: struct.SmartString.html#impl-Into%3CString%3E
94-
//! [serde]: https://crates.io/crates/serde
9594
//! [Serialize]: https://docs.rs/serde/latest/serde/trait.Serialize.html
9695
//! [Deserialize]: https://docs.rs/serde/latest/serde/trait.Deserialize.html
9796
//! [Arbitrary]: https://docs.rs/arbitrary/latest/arbitrary/trait.Arbitrary.html

0 commit comments

Comments
 (0)