Skip to content

Commit

Permalink
Merge pull request #98 from ParkMyCar/v/0.4
Browse files Browse the repository at this point in the history
version: 0.4
  • Loading branch information
ParkMyCar authored May 27, 2022
2 parents e51bb8e + e10d512 commit 81c43b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Upcoming

# 0.4
### May 27, 2022
* Rename `CompactStr` -> `CompactString` and `ToCompactStr` -> `ToComapctString`
* Implemented in [`#97 refactor: Rename CompactStr to CompactString`](https://github.com/ParkMyCar/compact_str/pull/95)
* Improve performance of `ToCompactStr` by reducing copies for some specialized types
* Implemented in [`#95 perf: Reduce copies in ToCompactStr for integer types`](https://github.com/ParkMyCar/compact_str/pull/95)
* Introduce the `ToCompactStr` trait, with specialized impls for common types
* Implemented in [`#16 Add && Impl new trait ToCompactStr`](https://github.com/ParkMyCar/compact_str/pull/16)
* Improve the performance of `From<Cow<'_, str>>`
* Implemented in [`#90 Optimize From<Cow<'a, str>> impl for CompactStr`](https://github.com/ParkMyCar/compact_str/pull/90)
* impl various `Add<T>` for `CompactStr`, enabling concatination with `+`
Implemented in [`#81 impl a bunch of Add<T>s for CompactStr, and Add<CompactStr> for String`](https://github.com/ParkMyCar/compact_str/pull/81)
* Improved the performance of `Drop` for inlined strings
* Implemented in [`#78 perf: Improve the performance of Repr::Drop for Inlined Variants`](https://github.com/ParkMyCar/compact_str/pull/78)
* impl `fmt::Write` for `CompactStr`
* Implemented in [`#73 Implement fmt::Write for CompactStr`](https://github.com/ParkMyCar/compact_str/pull/73)
* Inline short heap strings when resizing. After enabling `O(1)` conversion from `String` and `Box<str>` it became possible for short strings to be heap allocated. Now if we need to resize a short heap string, we'll inline it, instead of re-heap allocating.
* Implemented in [`#70 perf: Inline short heap strings when resizing`](https://github.com/ParkMyCar/compact_str/pull/70)

# 0.3.2
### March 27, 2022
* Enable `O(1)` conversion from `String` or `Box<str>` to `CompactStr`
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ A `CompactString` specifically has the following properties:
* Heap based string grows at a rate of 1.5x
* The std library `String` grows at a rate of 2x

### Traits
This crate exposes one trait, `ToCompactString` which provides the `to_compact_string(&self)` method for converting types into a `CompactString`. This trait is automatically implemented for all types that are `std::fmt::Display`, with specialized higher performance impls for:
* `u8`, `u16`, `u32`, `u64`, `usize`, `u128`
* `i8`, `i16`, `i32`, `i64`, `isize`, `i128`
* `f32`, `f64`
* `bool`, `char`
* `NonZeroU*`, `NonZeroI*`
* `String`, `CompactString`

### Features
`compact_str` has the following features:
1. `serde`, which implements [`Deserialize`](https://docs.rs/serde/latest/serde/trait.Deserialize.html) and [`Serialize`](https://docs.rs/serde/latest/serde/trait.Serialize.html) from the popular [`serde`](https://docs.rs/serde/latest/serde/) crate, for `CompactString`.
Expand Down
2 changes: 1 addition & 1 deletion compact_str/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "compact_str"
description = "A memory efficient string type that transparently stores strings on the stack, when possible"
version = "0.3.2"
version = "0.4.0"
authors = ["Parker Timmerman <[email protected]>"]
edition = "2018"
license = "MIT"
Expand Down

0 comments on commit 81c43b0

Please sign in to comment.