commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
f5d9ed83daa870f4e777dea2f130a1320c048b14 | Jiahao XU | 2022-06-07T12:09:54 | Impl `AsRef<OsStr>` for `CompactString`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 78c5ed83..627904af 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -30,6 +30,7 @@ use core::str::{
Utf8Error,
};
use std::borrow::Cow;
+use std::ffi::OsStr;
mod asserts;
mod features;
@@ -523,6 +524,13 @@ impl AsRef<str> f... | 1 | 8 | 0 |
fe26a72204d3e44dee41c93a473bcdac292150e0 | Parker Timmerman | 2022-05-27T22:20:21 | cargo fmt | diff --git a/compact_str/src/traits.rs b/compact_str/src/traits.rs
index 7dc5dd9a..6908e913 100644
--- a/compact_str/src/traits.rs
+++ b/compact_str/src/traits.rs
@@ -46,7 +46,6 @@ pub trait ToCompactString {
/// * [`CompactString`] does not contain any lifetime
/// * [`CompactString`] is 'static
/// * [`CompactStri... | 1 | 0 | 2 |
5934dfaf6ddcdce30543c88a80c448ef793da09b | Parker Timmerman | 2022-05-27T22:18:15 | small formatting and doc updates | diff --git a/compact_str/src/features/bytes.rs b/compact_str/src/features/bytes.rs
index 1affbb72..6849bd4e 100644
--- a/compact_str/src/features/bytes.rs
+++ b/compact_str/src/features/bytes.rs
@@ -32,7 +32,7 @@ impl CompactString {
/// // `bytes::Buf` is implemented for `std::io::Cursor<&[u8]>`
/// let mut ... | 4 | 13 | 12 |
a3a2c1637991957d025ecc01f42d015e637b7285 | Parker Timmerman | 2022-05-27T18:27:56 | cargo fmt | diff --git a/compact_str/src/repr/traits.rs b/compact_str/src/repr/traits.rs
index 16d7676f..05277f7c 100644
--- a/compact_str/src/repr/traits.rs
+++ b/compact_str/src/repr/traits.rs
@@ -103,7 +103,6 @@ mod tests {
prop_assert_eq!(val, roundtrip);
}
-
// `f32` formatting is broken on powerpc64le, n... | 1 | 0 | 1 |
b0d94d427d6ff8285758d968005a397be8caa897 | Parker Timmerman | 2022-05-27T18:20:21 | add comment explaining why f32 tests are disabled for some platforms | diff --git a/compact_str/src/repr/traits.rs b/compact_str/src/repr/traits.rs
index 6cea1605..16d7676f 100644
--- a/compact_str/src/repr/traits.rs
+++ b/compact_str/src/repr/traits.rs
@@ -67,38 +67,35 @@ mod tests {
}
#[test]
- #[cfg_attr(all(target_arch = "powerpc64", target_pointer_width = "64"), ignore... | 1 | 35 | 31 |
239f16e95f81e36edd7c9ea676f3ff99d0722264 | Parker Timmerman | 2022-05-27T18:07:55 | special case PowerPC 64-bit for f32 | diff --git a/compact_str/src/repr/traits.rs b/compact_str/src/repr/traits.rs
index c62a4cec..1b16b22f 100644
--- a/compact_str/src/repr/traits.rs
+++ b/compact_str/src/repr/traits.rs
@@ -10,9 +10,21 @@ pub trait IntoRepr {
impl IntoRepr for f32 {
fn into_repr(self) -> Repr {
- let mut buf = ryu::Buffer::... | 1 | 15 | 3 |
62dcf7bbe7ad61eb7d5a35bc43f06144046833a4 | Parker Timmerman | 2022-05-21T16:12:13 | specialize u128 | diff --git a/compact_str/src/repr/num.rs b/compact_str/src/repr/num.rs
index 8bae4fdc..b853074a 100644
--- a/compact_str/src/repr/num.rs
+++ b/compact_str/src/repr/num.rs
@@ -29,21 +29,7 @@ macro_rules! impl_IntoRepr {
//
// Note: this considers the `-` symbol
let num_... | 2 | 176 | 31 |
348402c355cc53a2707de2b65d5843c9defdf40c | Parker Timmerman | 2022-05-17T14:56:31 | disable cache on Raspberry Pi self-hosted | diff --git a/compact_str/src/repr/num.rs b/compact_str/src/repr/num.rs
index dd80207e..8bae4fdc 100644
--- a/compact_str/src/repr/num.rs
+++ b/compact_str/src/repr/num.rs
@@ -21,16 +21,21 @@ const DEC_DIGITS_LUT: &[u8] = b"\
8081828384858687888990919293949596979899";
macro_rules! impl_IntoRepr {
- ($t:iden... | 1 | 19 | 18 |
0ebbbb559507cca93af46d304da5e7ff2eb12a87 | Parker Timmerman | 2022-05-17T03:37:03 | clippy, fmt, and msrv changes | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index df6efab3..b508cfa7 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -17,14 +17,13 @@ mod inline;
mod num;
mod traits;
-pub use traits::IntoRepr;
-
use discriminant::{
Discriminant,
DiscriminantMask,
... | 3 | 13 | 14 |
dae75d96bb2bf6666316277f6263812c915bd183 | Parker Timmerman | 2022-05-17T03:24:18 | specialize char | diff --git a/compact_str/src/repr/traits.rs b/compact_str/src/repr/traits.rs
index 30c009e2..562a345a 100644
--- a/compact_str/src/repr/traits.rs
+++ b/compact_str/src/repr/traits.rs
@@ -34,6 +34,13 @@ impl IntoRepr for bool {
}
}
+impl IntoRepr for char {
+ fn into_repr(self) -> Repr {
+ let mut buf ... | 2 | 9 | 0 |
66c857a082124097520f6ec22608579d0da90014 | Parker Timmerman | 2022-05-17T03:11:36 | add specialization for ref types | diff --git a/compact_str/src/traits.rs b/compact_str/src/traits.rs
index 77e6d0e5..f471fcfb 100644
--- a/compact_str/src/traits.rs
+++ b/compact_str/src/traits.rs
@@ -61,18 +61,31 @@ impl<T: fmt::Display> ToCompactStr for T {
fn to_compact_str(&self) -> CompactStr {
let repr = match_type!(self, {
... | 1 | 13 | 0 |
85fc21d35d86c23eeba30265d5876b6347f9d1a3 | Parker Timmerman | 2022-05-17T03:06:56 | branch start, improve perf of ToComapctStr for integer types by reducing copies | diff --git a/bench/benches/random.rs b/bench/benches/random.rs
index edfcdaa9..ac7f985f 100644
--- a/bench/benches/random.rs
+++ b/bench/benches/random.rs
@@ -4,6 +4,7 @@ use criterion::{
black_box,
criterion_group,
criterion_main,
+ BenchmarkId,
Criterion,
};
@@ -33,5 +34,64 @@ fn cmp_min(c: ... | 9 | 801 | 217 |
8a5e920cca6fefbc2323a163714cbc8698f167d5 | Parker Timmerman | 2022-05-21T15:45:16 | branch start, update benchmarks | diff --git a/bench/benches/compact_str.rs b/bench/benches/compact_str.rs
index 0c19da82..b7fdfa22 100644
--- a/bench/benches/compact_str.rs
+++ b/bench/benches/compact_str.rs
@@ -55,8 +55,8 @@ fn bench_to_compact_str(c: &mut Criterion) {
);
c.bench_with_input(
- BenchmarkId::new("isize::to_compact_st... | 1 | 8 | 2 |
443878c820b2e32ed965f5ab00422247097286c6 | Parker Timmerman | 2022-05-17T03:01:33 | fix MSRV CI build | diff --git a/Cargo.toml b/Cargo.toml
index f89f6059..778ba86a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,9 @@
[workspace]
members = ["bench", "examples/bytes", "examples/serde", "compact_str", "fuzz"]
+[patch.crates-io]
# there's currently a bug with `arbitrary` that causes panics on 32-bit archs when the... | 2 | 4 | 2 |
b4572cddecac633f1e62c1a2389d786718c06990 | Parker Timmerman | 2022-05-17T02:33:52 | branch start, add some benchmarks for ToCompactStr (#94) | diff --git a/bench/benches/compact_str.rs b/bench/benches/compact_str.rs
index 6615eece..0c19da82 100644
--- a/bench/benches/compact_str.rs
+++ b/bench/benches/compact_str.rs
@@ -1,4 +1,7 @@
-use compact_str::CompactStr;
+use compact_str::{
+ CompactStr,
+ ToCompactStr,
+};
use criterion::{
criterion_group,... | 1 | 49 | 2 |
ede2b74705a39356af16214c32e6c6f6ea2d9d2d | Jiahao XU | 2022-05-01T21:31:09 | Optimize `From<Cow<'a, str>>` impl for `CompactStr` (#90)
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 28e006af..5add5141 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -584,8 +584,11 @@ impl<'a> From<&'a String> for CompactStr {
}
impl<'a> From<Cow<'a, str>> for CompactStr {
- fn from(s: Cow<'a, str>) -> Self {
- Compa... | 2 | 5 | 10 |
fb3eb495e5b708d9fd4b20444510fdcc3b54f0c1 | Parker Timmerman | 2022-04-26T15:46:19 | conditionally compile out the float block since we want to run other ignored tests | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index ed601e78..0a6ddd0a 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -390,8 +390,6 @@ macro_rules! assert_int_MAX_to_compact_str {
}
#[test]
-// TODO: Fix bug in powerpc64, which is a little endian system
-#[cfg_attr(not(al... | 1 | 17 | 15 |
316e88dccf385db8ac9c5583aa1c0daeaebfd49c | Parker Timmerman | 2022-04-26T15:05:14 | ignore entire test | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index fb3bddde..ed601e78 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -390,6 +390,8 @@ macro_rules! assert_int_MAX_to_compact_str {
}
#[test]
+// TODO: Fix bug in powerpc64, which is a little endian system
+#[cfg_attr(not(al... | 1 | 2 | 2 |
6d11b52fe32e990eef49af057f5c575a467871ce | Parker Timmerman | 2022-04-26T14:09:28 | branch start | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 2fea9611..fb3bddde 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -419,6 +419,8 @@ fn test_to_compact_str() {
assert_int_MAX_to_compact_str!(isize);
// Test specialisation for f32 and f64 using ryu
+ // TODO: ... | 1 | 2 | 0 |
5c74de35866dda4670738cc1ea1e129219771411 | Jiahao XU | 2022-04-26T11:59:08 | Rm buggy impl of `utility::Sink::Write::write_char`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index ec7a6871..98cd0eb5 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -19,12 +19,6 @@ impl Write for Sink {
self.0 += s.len();
Ok(())
}
-
- #[inline(always)]
- fn write_char(&mut self, _c: ch... | 1 | 0 | 6 |
305e11cf6e741022fc23adaeb6d724d6bae8ddc8 | Jiahao XU | 2022-04-25T04:01:56 | Optimize `to_compact_str_specialised`: Use chained if
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index a93d8eda..3ef0ed3f 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -18,14 +18,10 @@ const FALSE_COMPACT_STR: CompactStr = Compact... | 1 | 4 | 8 |
c0e5d005c26241cd9513c30911653aa518689905 | Jiahao XU | 2022-04-25T03:47:10 | Reduce the diff by using `cargo +nightly fmt --all`
To make this PR easier to review.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index bf47ed24..28e006af 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -16,10 +16,19 @@
use core::borrow::Borrow;
use core::cmp::Ordering;
use core::fmt;
-use core::hash::{Hash, Hasher};
+use core::hash::{
+ Hash,
+ Hasher,
+};
... | 6 | 51 | 17 |
4dd68b0cec7099a675edb16b7aff2253d689a6be | Jiahao XU | 2022-04-25T03:45:06 | Optimize `fmt::Write` impl for `Sink`
by implementing `fmt::Write::write_char`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index 40fa5f02..c9ac2400 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -16,6 +16,12 @@ impl Write for Sink {
self.0 += s.len();
Ok(())
}
+
+ #[inline(always)]
+ fn write_char(&mut self, _c: ch... | 1 | 6 | 0 |
769429f8916faf9144cd617c1a0c0486b0c30e57 | Jiahao XU | 2022-04-25T03:39:53 | Simplify `Sink` impl: Impl `fmt::Write` instead of `io::Write`
- Module `io` only present in `std`, while `fmt` present in `core`.
- `io::Write` requires additional `flush` method to be implemented.
- `io::Write::write` requires the len of bytes written to be returned.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.c... | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index 000a6a3f..40fa5f02 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -1,8 +1,4 @@
-use core::fmt;
-use std::io::{Result, Write};
-
-/// A special kind of sink that records the size of bytes writen into it.
-struct Sink(... | 1 | 6 | 12 |
b00a047cf74252bb8fdd7b9b114e32cc97e7a511 | Jiahao XU | 2022-04-25T03:32:42 | Simplify `ToCompactStr` using `CompactStr::with_capacity`
Instead of calling `Repr::from_fmt`, then forward it to
`Inline::from_fmt` or formatting into preallocated `String`,
this commit uses `CompactStr::with_capacity` to preallocate required
space ahead of time to avoid repeated heap allocation and copying, then
use... | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index d0bbc0be..bf47ed24 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -24,7 +24,9 @@ use std::borrow::Cow;
mod asserts;
mod features;
+
mod utility;
+use utility::count;
mod repr;
use repr::Repr;
@@ -769,12 +771,17 @@ pub trait... | 3 | 11 | 45 |
9f258bf42fd5630bc85368c47e42890f0c7493af | Jiahao XU | 2022-04-25T03:23:23 | Rename `to_compact_str!` to `format_compact!` in `src/tests.rs`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 51fe8da3..1a2b87c8 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -367,7 +367,7 @@ fn test_plus_operator() {
assert_eq!(String::from("a") + CompactStr::from("b"), "ab");
}
-macro_rules! to_compact_str {
+macro_rules!... | 1 | 7 | 7 |
1b14f26c108bde39c6d2c99109b5c3adccbfc3ef | Jiahao XU | 2022-04-25T03:21:12 | Rm features for specialisation
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index d5ca49f3..6485d5e0 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -11,19 +11,13 @@ readme = "../README.md"
keywords = ["string", "compact", "small", "memory", "mutable"]
categories = ["encoding", "parsing", "memory-management", "t... | 3 | 3 | 24 |
8ed9b51821d4ee73002a0ba493f3e73c0857eb4e | Jiahao XU | 2022-04-23T15:08:43 | Rm workaround for ryu on powerpc64le
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index e4f6ad51..256c626e 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -28,8 +28,7 @@ pub(super) fn to_compact_str_specialised<T>(val... | 1 | 1 | 3 |
9f6d7c9fd0ba61fa7bb7cb336d3425a84f13e3ce | Jiahao XU | 2022-04-22T04:02:35 | Improve test for float spec of `ToCompactStr`
Test different float values in the same `assert_eq` so that if one
`assert_eq`, we can obtain value of the formatting of all float values
we provided.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 8c65bcd1..51fe8da3 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -416,10 +416,12 @@ fn test_to_compact_str() {
assert_int_MAX_to_compact_str!(isize);
// Test specialisation for f32 and f64 using ryu
- assert_... | 1 | 5 | 3 |
d310ef0ded77b330f0310d618c58919b3924df21 | Jiahao XU | 2022-04-22T04:01:12 | Fix int spec for `NonZeroUsize` in `ToCompactStr`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 391c02b3..e4f6ad51 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -135,10 +135,7 @@ mod int_spec {
specialise!(val, u12... | 1 | 1 | 4 |
c42d514eabad460ff2172304036a90ec9b72e038 | Jiahao XU | 2022-04-22T04:00:24 | Bump dep castaway to v0.2.1
For `LifetimeFree` impl for `NonZeroUsize`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 422b7cf3..d5ca49f3 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -21,7 +21,7 @@ bytes = { version = "1", optional = true }
serde = { version = "1", optional = true }
# Specialisation
-castaway = { version = "0.2", optional = tr... | 1 | 1 | 1 |
3ec342b574a535a48911eaa0f6de521ae311b7d7 | Jiahao XU | 2022-04-22T02:49:31 | Fix code formatting of `utility::tests::count!`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index ef8863a2..000a6a3f 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -31,17 +31,17 @@ mod tests {
use core::format_args;
macro_rules! count {
- ( $fmt:expr $(, $args:tt)* ) => {
- count(
- ... | 1 | 10 | 10 |
a048c7d13c6d3937429da5a4ef8453ada11502bf | Jiahao XU | 2022-04-22T02:46:39 | Set vis of `utility::Sink` to private
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index 71b3f8c5..ef8863a2 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -2,7 +2,7 @@ use core::fmt;
use std::io::{Result, Write};
/// A special kind of sink that records the size of bytes writen into it.
-pub(crate) st... | 1 | 1 | 1 |
1fa20a9324d4b53b1616b93e20c696cc886e73f2 | Jiahao XU | 2022-04-22T02:45:38 | Make `Sink::count` a free function
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index 39818ad2..8dc0f0bd 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -1,4 +1,4 @@
-use crate::utility::Sink;
+use crate::utility::count;
use core::fmt::{self, Write};
use std::borrow::Cow;
@@ -110,7 +110,7 @@ im... | 2 | 14 | 11 |
4d53402f552c81a669033d105779e9f803ed07ff | Jiahao XU | 2022-04-22T02:42:24 | Rm unused `derive` from `utility::Sink`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index 6f15b53e..e804d467 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -2,7 +2,6 @@ use core::fmt;
use std::io::{Result, Write};
/// A special kind of sink that records the size of bytes writen into it.
-#[derive(Debu... | 1 | 0 | 1 |
8f4fd0e0676831f81c1987dbe405fa8adba26cc2 | Jiahao XU | 2022-04-22T02:41:09 | Accept `fmt::Display` param in `Sink::count`
to avoid using macro `count!` in `Repr::from_fmt`, which uses
`core::format_args!`, making it harder to optimize.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index 096180d1..39818ad2 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -1,3 +1,5 @@
+use crate::utility::Sink;
+
use core::fmt::{self, Write};
use std::borrow::Cow;
use std::iter::Extend;
@@ -108,7 +110,7 @@ impl R... | 2 | 17 | 15 |
59884e9cac3abca92dc6ab215fc822274407be9f | Jiahao XU | 2022-04-22T02:38:18 | Optimize `Sink::count`: Avoid using `Sink::default`
Use `Sink(0)` directly to make optimization easier.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index ca64e60a..3a953f52 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -7,7 +7,7 @@ pub(crate) struct Sink(usize);
impl Sink {
#[inline(always)]
pub(crate) fn count(args: fmt::Arguments) -> usize {
- let... | 1 | 1 | 1 |
f89570b1380154ad64a11d12389bd779e947cede | Jiahao XU | 2022-04-22T02:31:10 | Fix vis of `utility::Sink`: Use `pub(crate)` instead of `pub`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index 2fb0a437..ca64e60a 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -3,10 +3,10 @@ use std::io::{Result, Write};
/// A special kind of sink that records the size of bytes writen into it.
#[derive(Debug, Default)]
-... | 1 | 2 | 2 |
4c922a2d1ba98f2d9f5168a156ba09f72b5b467c | Jiahao XU | 2022-04-22T02:30:47 | Add inline hints to `utility::Sink`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index 738e2539..2fb0a437 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -5,6 +5,7 @@ use std::io::{Result, Write};
#[derive(Debug, Default)]
pub struct Sink(usize);
impl Sink {
+ #[inline(always)]
pub fn count(a... | 1 | 3 | 0 |
a9db24d254d2ec7f3325bf58fb88d977b8e6143e | Jiahao XU | 2022-04-22T02:29:01 | Fix vis of `utility::Sink.0`: Make it private
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/utility.rs b/compact_str/src/utility.rs
index ee7aace1..738e2539 100644
--- a/compact_str/src/utility.rs
+++ b/compact_str/src/utility.rs
@@ -3,7 +3,7 @@ use std::io::{Result, Write};
/// A special kind of sink that records the size of bytes writen into it.
#[derive(Debug, Default)]
-pu... | 1 | 1 | 1 |
252b02b612c7d98bfb8fe83e76d43645fdc656c7 | Jiahao XU | 2022-04-22T02:27:48 | Optimize `bool` spec for `ToCompactStr`
Avoid calling `CompactStr::new_inline` at runtime by using `const`
variable for "true" and "false".
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 2211dc52..391c02b3 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -9,6 +9,9 @@ use castaway::{cast, LifetimeFree};
/// - Compa... | 1 | 7 | 4 |
587f8dcac19f08182b608c6d79c95a24e75f4e56 | Jiahao XU | 2022-04-22T02:00:52 | Cover more code of `to_compact_str_specialised` in `test_to_compact_str`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 724cc20d..8c65bcd1 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -390,8 +390,11 @@ macro_rules! assert_int_MAX_to_compact_str {
fn test_to_compact_str() {
// Test specialisation for bool, char and String
assert_e... | 1 | 5 | 1 |
7ece80872b352e654f5feb9a3139f3ef2aa5a2f6 | Jiahao XU | 2022-04-22T01:58:21 | Add spec of `CompactStr` in `ToCompactStr`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 79dd0003..2211dc52 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -1,6 +1,13 @@
use super::CompactStr;
-use castaway::cast;
+... | 1 | 12 | 3 |
6c39bd3f3af9d6524630170c6337ae294d1ef875 | Jiahao XU | 2022-04-22T01:43:02 | Update float spec assert in `test_to_compact_str`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 954f1992..724cc20d 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -413,8 +413,11 @@ fn test_to_compact_str() {
assert_int_MAX_to_compact_str!(isize);
// Test specialisation for f32 and f64 using ryu
- assert_e... | 1 | 5 | 2 |
71140661f0aaa89d6e39d0fb61ae6adad91eeffa | Jiahao XU | 2022-04-21T15:44:57 | Fix unused fns in mod float_spec on powerpc64le
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 3b472766..79dd0003 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -133,6 +133,7 @@ mod int_spec {
}
#[cfg(feature = "to-comp... | 1 | 1 | 0 |
552938d578b20a9f81ddb5f74f6f59bd4ed095c0 | Jiahao XU | 2022-04-21T15:42:36 | Rm float spec workaround for powerpc64
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 5e95abc1..3b472766 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -19,7 +19,6 @@ pub(super) fn to_compact_str_specialised<T>(val... | 1 | 0 | 1 |
7a95ab11fec800e938507692b0d73abf44fa7ecd | Jiahao XU | 2022-04-21T15:40:55 | Fix workaround for float spec on powerpc64le
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 230628db..5e95abc1 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -20,6 +20,7 @@ pub(super) fn to_compact_str_specialised<T>(val... | 1 | 1 | 0 |
2bcbccdf4d49fa5f00e7a020601ad8207569ef0b | Jiahao XU | 2022-04-21T15:39:13 | Add workaround for float spec on powerpc64
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 3fab05e7..954f1992 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -413,11 +413,6 @@ fn test_to_compact_str() {
assert_int_MAX_to_compact_str!(isize);
// Test specialisation for f32 and f64 using ryu
- // FIXME... | 2 | 10 | 5 |
04956199d4e6a695c73c312189e5e789d445d5a6 | Jiahao XU | 2022-04-21T05:43:10 | Simplify `IsNewInlineable` impl for `usize` & `isize`
This crate only supports 32-bit and 64-bit, and on both of these
architecture `usize` and `isize` can be stored inline.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 33d704fb..7096825b 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -39,25 +39,6 @@ mod int_spec {
use core::num;
use it... | 1 | 3 | 22 |
0dc07f25038982679d895fb442456fb961402c71 | Jiahao XU | 2022-04-21T05:42:00 | Optimize `char` spec for `ToCompactStr`
Use `CompactStr::new_inline` instead of `CompactStr::new`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index 7de14497..33d704fb 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -23,7 +23,9 @@ pub(super) fn to_compact_str_specialised<T>(val... | 1 | 3 | 1 |
97da81cd38fe42aa2a9433239f6d4c1145e8f971 | Jiahao XU | 2022-04-21T05:41:00 | Optimize `bool` spec for `ToCompactStr`
Use `CompactStr::new_inline` instead of `CompactStr::new`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index e63260c9..7de14497 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -15,7 +15,11 @@ pub(super) fn to_compact_str_specialised<T>(va... | 1 | 5 | 1 |
e048e314b3185308d5920e39cc985872cafdf650 | Jiahao XU | 2022-04-21T05:35:53 | Add `FIXME` to float spec test in `test_to_compact_str`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 954f1992..3fab05e7 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -413,6 +413,11 @@ fn test_to_compact_str() {
assert_int_MAX_to_compact_str!(isize);
// Test specialisation for f32 and f64 using ryu
+ // FIXME... | 1 | 5 | 0 |
337a37cef8c1e56fe1ba50968294197487ba161a | Jiahao XU | 2022-04-21T05:30:14 | Fix unused `target_pointer_width` warning
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index dc8154b1..e63260c9 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -2,25 +2,6 @@ use super::CompactStr;
use castaway::cast;
... | 1 | 19 | 19 |
2472190aaeaee4a98f190ae113cf9a721e5b1c7f | Jiahao XU | 2022-04-21T05:26:12 | Optimize `int_to_compact_str` by using `new_inline`
if possible
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index 805100d7..096180d1 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -19,7 +19,7 @@ use discriminant::{Discriminant, DiscriminantMask};
use heap::HeapString;
use inline::InlineString;
-const MAX_SIZE: usize = st... | 3 | 86 | 3 |
b1177cb793385802e122ba588b78ab714e65e911 | Jiahao XU | 2022-04-21T04:29:37 | Add inline hints to fn in `to_compact_str_specialisation`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/to_compact_str_specialisation.rs b/compact_str/src/to_compact_str_specialisation.rs
index a904b072..395b8dc2 100644
--- a/compact_str/src/to_compact_str_specialisation.rs
+++ b/compact_str/src/to_compact_str_specialisation.rs
@@ -2,6 +2,7 @@ use super::CompactStr;
use castaway::cast;
+... | 1 | 2 | 0 |
d787a971a0acf3a6c228788b0c85a116e9421b41 | Jiahao XU | 2022-04-21T04:29:11 | Add float spec for `ToCompactStr`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index bc311e7c..9af0045e 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -391,6 +391,19 @@ fn test_to_compact_str() {
assert_eq!("234", 234.to_compact_str());
assert_eq!("234", num::NonZeroU64::new(234).unwrap().to_compac... | 2 | 41 | 0 |
a3709a80203e80d9e16ec6ce613a810f76721b05 | Jiahao XU | 2022-04-21T04:14:42 | Add feature "to-compact-str-float-spec"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index c7a3f279..422b7cf3 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -12,12 +12,15 @@ keywords = ["string", "compact", "small", "memory", "mutable"]
categories = ["encoding", "parsing", "memory-management", "text-processing"]
[feat... | 1 | 3 | 0 |
3b58f1b5c49b3861cc710c8fe565877de5707c28 | Jiahao XU | 2022-04-21T04:13:52 | Add optional dep ryu v1.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 286a12df..c7a3f279 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -20,6 +20,7 @@ bytes = { version = "1", optional = true }
serde = { version = "1", optional = true }
castaway = { version = "0.2", optional = true }
itoa = { versi... | 1 | 1 | 0 |
dea3dc1367cc96ef0add24bd84c6a63500247561 | Jiahao XU | 2022-04-21T03:33:27 | Fix feature `to-compact-str-int-spec`
It should enale feature `itoa`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 1b643cda..286a12df 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -12,7 +12,7 @@ keywords = ["string", "compact", "small", "memory", "mutable"]
categories = ["encoding", "parsing", "memory-management", "text-processing"]
[featur... | 1 | 1 | 1 |
b169cde06e3f763731744089bbdcf3f69b448b80 | Jiahao XU | 2022-04-21T03:28:39 | Add int spec for `ToCompactStr`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index ba8a50e8..bc311e7c 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -1,3 +1,4 @@
+use std::num;
use std::str::FromStr;
use proptest::prelude::*;
@@ -381,10 +382,16 @@ macro_rules! to_compact_str {
#[test]
fn test_to_co... | 2 | 59 | 1 |
a3eed658d3281e661fa68ad2ce0f7a939dce4684 | Jiahao XU | 2022-04-21T02:37:02 | Add feature "to-compact-str-int-spec"
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 43055c29..1b643cda 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -12,6 +12,7 @@ keywords = ["string", "compact", "small", "memory", "mutable"]
categories = ["encoding", "parsing", "memory-management", "text-processing"]
[featur... | 1 | 1 | 0 |
dfb66af3f326a25474dceed76c7dc50b96695266 | Jiahao XU | 2022-04-21T02:36:28 | Add optional dep itoa v1.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 487b02d8..43055c29 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -18,6 +18,7 @@ to-compact-str-specialisation = ["castaway"]
bytes = { version = "1", optional = true }
serde = { version = "1", optional = true }
castaway = { vers... | 1 | 1 | 0 |
20ec9d541a6bacc4dc96f1c2d19c307c72be4d81 | Jiahao XU | 2022-04-21T02:31:13 | Add to_compact_str_specialisation for `bool`, `String` & `char`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 4701ba8f..88c1114b 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -18,14 +18,8 @@ use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hash, Hasher};
use core::iter::FromIterator;
-use core::ops::{
- Add,
- Deref,
-};
-... | 3 | 31 | 9 |
056ef48d64c0bc4aaffff80e16e1e124d9741308 | Jiahao XU | 2022-04-21T02:24:31 | Rm `?Sized` relaxtion for `ToCompactStr`
`castaway::cast!` cannot cast reference of `T: ?Sized` to primitive
types
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 92110883..4701ba8f 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -770,7 +770,7 @@ pub trait ToCompactStr {
/// since `std::fmt::Write for String` never returns an error itself and
/// the implementation of `ToCompactStr::to_compa... | 1 | 1 | 1 |
48540eb3268c957b029c296a0a7737a899b552a4 | Jiahao XU | 2022-04-21T02:14:48 | Add feature `to-compact-str-specialisation`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index d5fc3a44..487b02d8 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -11,7 +11,8 @@ readme = "../README.md"
keywords = ["string", "compact", "small", "memory", "mutable"]
categories = ["encoding", "parsing", "memory-management", "tex... | 1 | 2 | 1 |
8dd55f53ee734bec80007643d23002fa07678bc7 | Jiahao XU | 2022-04-21T02:14:09 | Add optional dep castaway v0.2
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 2eae622b..d5fc3a44 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -16,6 +16,7 @@ categories = ["encoding", "parsing", "memory-management", "text-processing"]
[dependencies]
bytes = { version = "1", optional = true }
serde = { ver... | 1 | 1 | 0 |
b8bf0f09922e4b1277bb1a1b8e3a1cbdbd52dcb5 | Jiahao XU | 2022-04-07T03:37:48 | Fix MSRV issue caused by `InlineString::from_fmt`
`[u8; _]::as_mut_slice` is only present in rust >= 1.57.0
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/inline.rs b/compact_str/src/repr/inline.rs
index 87001c36..1722cf12 100644
--- a/compact_str/src/repr/inline.rs
+++ b/compact_str/src/repr/inline.rs
@@ -46,7 +46,7 @@ impl InlineString {
// note: in the case where len == MAX_SIZE, we'll overwrite the len, but that's okay becau... | 1 | 1 | 1 |
67b76f24709911560a3d4285b59befa5057a2ff0 | Jiahao XU | 2022-04-07T03:35:37 | Simplify `InlineString::from_fmt` impl: `write!` to buffer directly
Instead of using `std::io::Cursor`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/inline.rs b/compact_str/src/repr/inline.rs
index af059d22..87001c36 100644
--- a/compact_str/src/repr/inline.rs
+++ b/compact_str/src/repr/inline.rs
@@ -1,5 +1,5 @@
use core::fmt;
-use std::io::{Cursor, Write};
+use std::io::Write;
use super::MAX_SIZE;
@@ -46,8 +46,7 @@ impl Inli... | 1 | 2 | 3 |
339def9ce4daae498dc4ca71028d95c9daa5bac7 | Jiahao XU | 2022-04-07T03:32:19 | Refactor: Inline `utility::format_into_buffer`
into `InlineString::from_fmt`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/inline.rs b/compact_str/src/repr/inline.rs
index c407d7f7..af059d22 100644
--- a/compact_str/src/repr/inline.rs
+++ b/compact_str/src/repr/inline.rs
@@ -1,7 +1,7 @@
use core::fmt;
+use std::io::{Cursor, Write};
use super::MAX_SIZE;
-use crate::utility::format_into_buffer;
const ... | 2 | 4 | 12 |
6252852e17caabfc6c0b7dd6705fa5b8cc868b71 | Jiahao XU | 2022-04-07T03:09:02 | Optimize `Repr::from_fmt` for `InlineString`.
Impl new function `InlineString::from_fmt` to avoid copying the buffer
for `InlineString`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/inline.rs b/compact_str/src/repr/inline.rs
index b8806d37..c407d7f7 100644
--- a/compact_str/src/repr/inline.rs
+++ b/compact_str/src/repr/inline.rs
@@ -1,4 +1,7 @@
+use core::fmt;
+
use super::MAX_SIZE;
+use crate::utility::format_into_buffer;
const LENGTH_MASK: u8 = 0b11000000;
... | 2 | 25 | 9 |
e99f5568780c0c05ce018a74d3ac1636d7b154aa | Mike Cronce | 2022-04-05T03:50:45 | compact_str/src/tests.rs: + test_plus_operator() | diff --git a/compact_str/src/tests.rs b/compact_str/src/tests.rs
index 890cfaad..3689478a 100644
--- a/compact_str/src/tests.rs
+++ b/compact_str/src/tests.rs
@@ -355,3 +355,13 @@ fn test_fmt_write() {
write!(compact, "{:>8} {} {:<8}", "some", "more", "words").unwrap();
assert_eq!(compact, "test1234\n some... | 1 | 10 | 0 |
4024cb54d9cb3d5c0926f46f1da155aef71022a8 | Mike Cronce | 2022-04-05T03:50:17 | compact_str/src/lib.rs: Add a bunch of Add<T> impls for CompactStr, and Add<CompactStr> for String | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 2d6e1165..c7e24ea5 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -21,7 +21,10 @@ use core::hash::{
Hasher,
};
use core::iter::FromIterator;
-use core::ops::Deref;
+use core::ops::{
+ Add,
+ Deref,
+};
use core::str::{... | 1 | 52 | 1 |
348fbcdbe29e5b0b3ed6636e691bf6bf5b028a9f | Jiahao XU | 2022-04-04T02:37:30 | Fix doc of `ToCompactStr::to_compact_str`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 202a8a04..fe83f2a0 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -698,8 +698,10 @@ pub trait ToCompactStr {
/// Basic usage:
///
/// ```
+ /// use compact_str::ToCompactStr;
+ ///
/// let i = 5;
- /// l... | 1 | 3 | 1 |
a5af4007e4ca5c9c6a7eae07c08e12e9382b3c66 | Jiahao XU | 2022-04-04T02:34:19 | Optimize `Repr::from_fmt`: Optimize formatting to `String`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index d566747e..73751a67 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -1,4 +1,4 @@
-use core::fmt;
+use core::fmt::{self, Write};
use std::borrow::Cow;
use std::iter::Extend;
use std::mem::ManuallyDrop;
@@ -119,7 ... | 1 | 4 | 2 |
f00cf3320cc2a991fce34118da21f961c6b9431e | Jiahao XU | 2022-04-03T14:09:16 | Impl trait `ToCompactStr`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 2d6e1165..202a8a04 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -16,20 +16,15 @@
use core::borrow::Borrow;
use core::cmp::Ordering;
use core::fmt;
-use core::hash::{
- Hash,
- Hasher,
-};
+use core::hash::{Hash, Hasher};
... | 4 | 154 | 17 |
2ba09e217f7b14b697f600e5ee70f3cb703f48de | Parker Timmerman | 2022-04-01T16:24:01 | cargo fmt | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index 228777b2..d6809ff8 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -261,8 +261,8 @@ impl Clone for Repr {
impl Drop for Repr {
#[inline]
fn drop(&mut self) {
- // By "outlining" the actual Drop c... | 1 | 2 | 2 |
43bd90a4e0b5a8aca4a5d34dd664e06b2b33bf3d | Parker Timmerman | 2022-04-01T15:56:15 | add a comment | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index e4b7b44c..228777b2 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -261,6 +261,8 @@ impl Clone for Repr {
impl Drop for Repr {
#[inline]
fn drop(&mut self) {
+ // By "outlining" the actual Drop c... | 1 | 2 | 0 |
aea3ad7d4f9aa4f725f6e515ec844ffead0e2195 | Parker Timmerman | 2022-04-01T15:41:56 | branch start, fast path | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index 8b9d107a..e4b7b44c 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -211,7 +211,7 @@ impl Repr {
#[inline]
pub fn is_heap_allocated(&self) -> bool {
- matches!(self.cast(), StrongRepr::Heap(..))
... | 1 | 15 | 7 |
d96254bcfb97614c1fcbd7b7a2a75dcd447eda66 | René Kijewski | 2022-03-31T16:32:43 | Implement fmt::Write for CompactStr
This makes it possible to `write!()` into a CompactStr. This is useful
if you know that the formatted string will be (most often) shorter than
24 bytes. | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 96606918..2d6e1165 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -678,4 +678,11 @@ impl Extend<String> for CompactStr {
}
}
+impl fmt::Write for CompactStr {
+ fn write_str(&mut self, s: &str) -> fmt::Result {
+ s... | 2 | 23 | 0 |
b788a8e4c67d77f2392b19357527f1c251aa87b9 | CAD97 | 2022-03-31T16:59:45 | Improve bench hygeine somewhat | diff --git a/bench/benches/compact_str.rs b/bench/benches/compact_str.rs
index 20456f1f..6615eece 100644
--- a/bench/benches/compact_str.rs
+++ b/bench/benches/compact_str.rs
@@ -2,33 +2,41 @@ use compact_str::CompactStr;
use criterion::{
criterion_group,
criterion_main,
+ BenchmarkId,
Criterion,
};... | 1 | 28 | 20 |
b209fb8c86c8eb3c20630e335d3d959455f37adb | Parker Timmerman | 2022-03-27T18:55:47 | remove the efficient keyword from Cargo.toml | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 2bca65e9..2eae622b 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -8,7 +8,7 @@ license = "MIT"
homepage = "https://github.com/ParkMyCar/compact_str"
repository = "https://github.com/ParkMyCar/compact_str"
readme = "../README.md"
... | 1 | 1 | 1 |
cf55ec34c096c1d8dcfe0e74219507199b4c772f | Parker Timmerman | 2022-03-27T16:33:15 | branch start, inline short heap strings when resizing | diff --git a/compact_str/src/repr/mod.rs b/compact_str/src/repr/mod.rs
index fce39b93..8b9d107a 100644
--- a/compact_str/src/repr/mod.rs
+++ b/compact_str/src/repr/mod.rs
@@ -128,15 +128,19 @@ impl Repr {
return;
}
- // Note: Inlined strings are already their maximum size. So if our curre... | 1 | 58 | 9 |
f44089038edce2889c26c5480937e8c55b2ca0f3 | Parker Timmerman | 2022-03-27T04:54:39 | use test-strategy 0.1.2 which should use Rust 2018 | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 22c04850..a3c6fe1e 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -19,4 +19,4 @@ serde = { version = "1", optional = true }
[dev-dependencies]
proptest = { version = "1", default-features = false, features = ["std"] }
-test-stra... | 1 | 1 | 1 |
7ba93435c30c834252d7795133b9385ee0965974 | Parker Timmerman | 2022-03-27T04:43:50 | branch start, cleanup use of proptest with test-strategy | diff --git a/compact_str/Cargo.toml b/compact_str/Cargo.toml
index 70f390f5..22c04850 100644
--- a/compact_str/Cargo.toml
+++ b/compact_str/Cargo.toml
@@ -19,3 +19,4 @@ serde = { version = "1", optional = true }
[dev-dependencies]
proptest = { version = "1", default-features = false, features = ["std"] }
+test-stra... | 6 | 174 | 186 |
cf21ff810e963423ce9932835c1610b386cf6832 | Parker Timmerman | 2022-03-27T03:25:40 | branch start, do a run through of all docs to make sure they're up-to-date and intra doc links work | diff --git a/compact_str/src/repr/bytes.rs b/compact_str/src/repr/bytes.rs
index f4d5da6a..11327b04 100644
--- a/compact_str/src/repr/bytes.rs
+++ b/compact_str/src/repr/bytes.rs
@@ -8,7 +8,7 @@ use super::{
};
impl Repr {
- /// Converts a buffer of bytes to a `Repr`,
+ /// Converts a [`Buf`] of bytes to a [`... | 5 | 13 | 12 |
3751d9680a4bd59f35f3676a3b776469bbdc8dc2 | Parker Timmerman | 2022-03-27T03:12:16 | add doc comments to the fuzzing suite | diff --git a/fuzz/src/lib.rs b/fuzz/src/lib.rs
index 3652eef4..4a0fcdc8 100644
--- a/fuzz/src/lib.rs
+++ b/fuzz/src/lib.rs
@@ -18,13 +18,21 @@ pub struct Scenario<'a> {
#[derive(Arbitrary, Debug)]
pub enum Creation<'a> {
+ /// Create using [`CompactStr::from_utf8`]
Bytes(&'a [u8]),
+ /// Create using [`C... | 1 | 8 | 8 |
40bd5dfc158574028b1aba7d595d654405c92058 | Parker Timmerman | 2022-03-27T03:05:12 | cargo fmt | diff --git a/fuzz/src/lib.rs b/fuzz/src/lib.rs
index 973fff31..3652eef4 100644
--- a/fuzz/src/lib.rs
+++ b/fuzz/src/lib.rs
@@ -41,13 +41,13 @@ impl Creation<'_> {
assert_properly_allocated(&compact, &word);
Some((compact, word))
- },
+ }
// Create a... | 1 | 4 | 4 |
8a63279ffb44bc0778cf4f87d40473083f0b11d5 | Parker Timmerman | 2022-03-26T20:02:38 | MVP Box<str> O(1) | diff --git a/bench/benches/apis.rs b/bench/benches/apis.rs
index f9f89284..d6a50c41 100644
--- a/bench/benches/apis.rs
+++ b/bench/benches/apis.rs
@@ -1,5 +1,7 @@
//! Benchmarks for various APIs to make sure `CompactStr` is at least no slower than `String`
+use std::time::Instant;
+
use compact_str::CompactStr;
us... | 6 | 43 | 11 |
5eaaeb47f0aa5eec7e3bc56ac3c595b976d5a819 | Parker Timmerman | 2022-03-26T19:52:14 | CompactStr O(1) From<String> | diff --git a/bench/benches/apis.rs b/bench/benches/apis.rs
index 9f8969d7..f9f89284 100644
--- a/bench/benches/apis.rs
+++ b/bench/benches/apis.rs
@@ -7,6 +7,7 @@ use criterion::{
criterion_main,
Criterion,
};
+use std::time::Instant;
static VERY_LONG_STR: &str = include_str!("../data/moby10b.txt");
@@ ... | 7 | 125 | 36 |
5cc5f79b62e3ad0ae6f222b32aa2b3b270e1aa0f | Parker Timmerman | 2022-03-25T22:28:21 | cargo fmt | diff --git a/compact_str/src/repr/boxed/mod.rs b/compact_str/src/repr/boxed/mod.rs
index 73482448..482e76af 100644
--- a/compact_str/src/repr/boxed/mod.rs
+++ b/compact_str/src/repr/boxed/mod.rs
@@ -41,7 +41,9 @@ impl BoxString {
// length `len` because `len` comes from `src`, and `dest` was allocated to be at... | 1 | 30 | 26 |
8e680e119fc0c0638d44177fcec2a007973974d7 | Parker Timmerman | 2022-03-25T22:27:52 | add more unit tests, remove slow proptests | diff --git a/compact_str/src/repr/boxed/mod.rs b/compact_str/src/repr/boxed/mod.rs
index 1285c897..73482448 100644
--- a/compact_str/src/repr/boxed/mod.rs
+++ b/compact_str/src/repr/boxed/mod.rs
@@ -388,8 +388,8 @@ impl From<String> for BoxString {
Ok(cap) => {
let len = s.len();
... | 1 | 69 | 16 |
bbb6d6a29617f9a3e1a055cbb29ddf3d4a7e3fb1 | Parker Timmerman | 2022-03-24T21:13:07 | in progress | diff --git a/compact_str/src/repr/boxed/mod.rs b/compact_str/src/repr/boxed/mod.rs
index 02ae6854..1285c897 100644
--- a/compact_str/src/repr/boxed/mod.rs
+++ b/compact_str/src/repr/boxed/mod.rs
@@ -380,6 +380,26 @@ impl From<&str> for BoxString {
}
}
+impl From<String> for BoxString {
+ #[inline]
+ fn fr... | 1 | 51 | 0 |
62b13414767145b90715b92f60e32556a65bf1b0 | Parker Timmerman | 2022-03-19T22:55:11 | unignore test | diff --git a/compact_str/src/repr/boxed/mod.rs b/compact_str/src/repr/boxed/mod.rs
index 89ca34c0..02ae6854 100644
--- a/compact_str/src/repr/boxed/mod.rs
+++ b/compact_str/src/repr/boxed/mod.rs
@@ -576,17 +576,17 @@ mod tests {
}
}
- // proptest! {
- // // The next line modifies the number of... | 1 | 11 | 11 |
1d331794bddc3eab25cccd8d1339545d0e883e47 | Parker Timmerman | 2022-03-19T20:09:03 | remove long running test | diff --git a/compact_str/src/repr/boxed/mod.rs b/compact_str/src/repr/boxed/mod.rs
index 2a50edf5..7a21d7d9 100644
--- a/compact_str/src/repr/boxed/mod.rs
+++ b/compact_str/src/repr/boxed/mod.rs
@@ -563,17 +563,17 @@ mod tests {
}
}
- proptest! {
- // The next line modifies the number of tests... | 1 | 11 | 11 |
5986044b935e8e4eca74894317acc139972f322f | Parker Timmerman | 2022-03-19T18:50:08 | cargo fmt | diff --git a/compact_str/src/repr/boxed/inner.rs b/compact_str/src/repr/boxed/inner.rs
index b1de649f..3689aff1 100644
--- a/compact_str/src/repr/boxed/inner.rs
+++ b/compact_str/src/repr/boxed/inner.rs
@@ -4,13 +4,14 @@ pub type StrBuffer = [u8; UNKNOWN];
pub mod heap_capacity {
use core::ptr;
use std::allo... | 2 | 16 | 21 |
5ea0f84a4b0abf8a02bc6d9683069469f8799fdf | Parker Timmerman | 2022-03-19T18:46:47 | MVP for capacity on the stack | diff --git a/compact_str/src/lib.rs b/compact_str/src/lib.rs
index 9e464977..72a8312a 100644
--- a/compact_str/src/lib.rs
+++ b/compact_str/src/lib.rs
@@ -1,3 +1,5 @@
+#![allow(dead_code)]
+
//! [`CompactStr`] is a compact string type that stores itself on the stack if possible, otherwise
//! known as a "small string... | 4 | 315 | 75 |
17c7a91792120caa11ffc728b7c23b2435af0ffe | Parker Timmerman | 2022-03-07T01:32:40 | fix some lints, add some docs | diff --git a/compact_str/src/repr/boxed/capacity.rs b/compact_str/src/repr/boxed/capacity.rs
index 36075be3..4b7d7860 100644
--- a/compact_str/src/repr/boxed/capacity.rs
+++ b/compact_str/src/repr/boxed/capacity.rs
@@ -2,21 +2,44 @@ use crate::repr::HEAP_MASK;
// how many bytes a `usize` occupies
const USIZE_SIZE: ... | 1 | 31 | 7 |
d825a0bdbbf8469c1614dd283a75ce56ab897b12 | Parker Timmerman | 2022-03-06T23:18:11 | fix unused code | diff --git a/compact_str/src/repr/boxed/capacity.rs b/compact_str/src/repr/boxed/capacity.rs
index 779e9bad..c3477604 100644
--- a/compact_str/src/repr/boxed/capacity.rs
+++ b/compact_str/src/repr/boxed/capacity.rs
@@ -4,14 +4,14 @@ const CAPACITY_SPACE: usize = core::mem::size_of::<usize>() - 1;
#[derive(Debug)]
p... | 1 | 2 | 2 |
e0530bd06bf1da40a84d0b3461e340fb8d65ac01 | Parker Timmerman | 2022-03-06T23:15:49 | add Capacity struct | diff --git a/compact_str/src/repr/boxed/capacity.rs b/compact_str/src/repr/boxed/capacity.rs
index 22bb64c5..779e9bad 100644
--- a/compact_str/src/repr/boxed/capacity.rs
+++ b/compact_str/src/repr/boxed/capacity.rs
@@ -1,3 +1,20 @@
+use crate::repr::HEAP_MASK;
+
+const CAPACITY_SPACE: usize = core::mem::size_of::<usize... | 3 | 32 | 27 |
55b0f24add58fa3cc40b5577dc45f67d3bccdf0d | Parker Timmerman | 2022-03-06T22:49:39 | branch start | diff --git a/compact_str/src/repr/boxed/capacity.rs b/compact_str/src/repr/boxed/capacity.rs
new file mode 100644
index 00000000..22bb64c5
--- /dev/null
+++ b/compact_str/src/repr/boxed/capacity.rs
@@ -0,0 +1,3 @@
+pub struct Capacity {
+
+}
diff --git a/compact_str/src/repr/boxed/mod.rs b/compact_str/src/repr/boxe... | 2 | 4 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.