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 |
|---|---|---|---|---|---|---|---|
641590223eb4ff52768a79591fdcc57ae981cbe3 | Lokathor | 2020-01-19T20:02:54 | `cargo fmt` hasn't been used in a while it seems. | diff --git a/fuzz/src/arb_range.rs b/fuzz/src/arb_range.rs
index f0db947..0a14f94 100644
--- a/fuzz/src/arb_range.rs
+++ b/fuzz/src/arb_range.rs
@@ -1,61 +1,64 @@
use arbitrary::{Arbitrary, Unstructured};
-use std::ops::{Range, RangeBounds, RangeFrom, RangeInclusive, RangeTo, RangeToInclusive, Bound};
+use std::ops::{... | 8 | 141 | 127 |
30516bc4d67c9a0148134f76a7817f3910181737 | Lokathor | 2020-01-19T20:02:14 | greatly improve extend_from_slice (+formatting)
Closes https://github.com/Lokathor/tinyvec/issues/25
(Thanks ThatsNoMoon!) | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 7a3687d..f665498 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -10,9 +10,9 @@ use super::*;
///
/// ```rust
/// use tinyvec::*;
-///
+///
/// let empty_av = array_vec!([u8; 16]);
-///
+///
/// let some_ints = array_vec!([i32; 4], 1, 2, 3);
/// ```
#[... | 1 | 54 | 38 |
b008c95a372abc3869fe22614214573a27c9aca2 | Lokathor | 2020-01-19T19:59:21 | improve ArrayVec::push panic message
Closes https://github.com/Lokathor/tinyvec/issues/24 | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index dc9cb50..7a3687d 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -352,7 +352,7 @@ impl<A: Array> ArrayVec<A> {
replace(&mut self.data.as_slice_mut()[self.len], val);
self.len += 1;
} else {
- panic!("ArrayVec: overflow!")
+ panic!("... | 1 | 1 | 1 |
73a5050f0d5e46d5964b0f7538bdc089aeebea43 | mental | 2020-01-19T05:07:35 | Account for heap capacity in capacity unit test | diff --git a/tests/tinyvec.rs b/tests/tinyvec.rs
index 6295458..7a642ee 100644
--- a/tests/tinyvec.rs
+++ b/tests/tinyvec.rs
@@ -23,8 +23,11 @@ fn TinyVec_swap_remove() {
#[test]
fn TinyVec_capacity() {
- let tv: TinyVec<[i32; 10]> = Default::default();
- assert_eq!(tv.capacity(), 10);
+ let mut tv: TinyVec<[i32... | 1 | 5 | 2 |
f5de23493bd3969592008855d91e79b8e36f7924 | mental | 2020-01-19T04:57:34 | Account for heap allocated capacities. | diff --git a/src/tinyvec.rs b/src/tinyvec.rs
index 9edf4f7..0bb84e9 100644
--- a/src/tinyvec.rs
+++ b/src/tinyvec.rs
@@ -170,11 +170,15 @@ impl<A: Array> TinyVec<A> {
/// The capacity of the `TinyVec`.
///
- /// This is fixed based on the array type.
+ /// When not heap allocated this is fixed based on the a... | 2 | 12 | 2 |
83664ad87e5afe5b1888a2af93abecd0b86634c0 | Andreas Molzer | 2020-01-18T18:28:36 | Add a fill method, a panic-free extend alternative
This is an alternative to `Extend::extend` method for cases where the
length of the iterator can not be checked. Since this vector can not
reallocate to increase its capacity, it is unclear what to do with
remaining elements in the iterator and the iterator itself. Th... | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 1c007d9..381dc18 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -510,6 +510,38 @@ impl<A: Array> ArrayVec<A> {
}
}
+ /// Fill the vector until its capacity has been reached.
+ ///
+ /// Successively fills unused space in the spare slice of the vec... | 1 | 32 | 0 |
4cbd1db0a035a1e39928d7a0a5430191536afa51 | Andreas Molzer | 2020-01-18T18:01:40 | Fix element drop order on failed insert | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 1c007d9..5a64cff 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -276,7 +276,8 @@ impl<A: Array> ArrayVec<A> {
/// index.
///
/// ## Panics
- /// * If `index` > `len`
+ /// * If `index` > `len` or
+ /// * If the capacity is exhausted
///
/// #... | 1 | 11 | 19 |
b23ac5d8864086bac380407cdc071db91d6de21e | Andreas Molzer | 2020-01-18T17:24:06 | Implement linear time retain | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 1c007d9..3787b09 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -477,12 +477,35 @@ impl<A: Array> ArrayVec<A> {
/// ```
#[inline]
pub fn retain<F: FnMut(&A::Item) -> bool>(&mut self, mut acceptable: F) {
- let mut i = 0;
- while i < self.len {
-... | 1 | 28 | 5 |
04c799ffcf5be29ab213c7657534dda05c64112f | Andreas Molzer | 2020-01-18T15:23:35 | Simplify resize with element or function
Avoids a call to Clone of the element by using the provided instance as
the one inserted last. A similar optimization is used in the standard
library. Also changes the iteration to an independent iterator as the
number of insert elements must be known in advance. | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index c9285ca..1c007d9 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -414,14 +414,14 @@ impl<A: Array> ArrayVec<A> {
where
A::Item: Clone,
{
- use core::cmp::Ordering;
- match new_len.cmp(&self.len) {
- Ordering::Less => self.truncate(new_len)... | 1 | 10 | 12 |
a8c5b4e7ac4a6fa3a5d82d5d10c716f1156d7230 | Andreas Molzer | 2020-01-18T15:10:12 | Use mem::take shorthand for defaulted replace
This makes the code more readable by shortening lines and avoid explicit
or redundant type annotations. The core function would require a rust
version of 1.40 so straightforward implementation is added to the crate. | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 3b86dd5..c9285ca 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -343,8 +343,7 @@ impl<A: Array> ArrayVec<A> {
pub fn pop(&mut self) -> Option<A::Item> {
if self.len > 0 {
self.len -= 1;
- let out =
- replace(&mut self.data.as_slice_m... | 2 | 9 | 6 |
2f94e40d815ae8b6863d3bfd423af72a9421f1bf | Andreas Molzer | 2020-01-18T15:05:13 | Switch to slice swapping for split
The new slice is already initialized with default values for T due to
the constructor used. Instead of using different defaulted values for
replacing the split-off instances we can simply swap slices. This
reduces pressure on the optimizer and uses a probably optimized method
from th... | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 608312c..3b86dd5 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -544,11 +544,10 @@ impl<A: Array> ArrayVec<A> {
}
let mut new = Self::default();
let moves = &mut self.as_mut_slice()[at..];
- let targets = new.data.as_slice_mut();
- for (m,... | 1 | 4 | 5 |
14fd50648b64bacb4e89ac8d2590e33cb2f28ce3 | Andreas Molzer | 2020-01-18T12:36:46 | Fix the fuzz target
Was broken due to renaming in 85377b68152faace3c59e5d73b41bb7ab8b7e82e. | diff --git a/fuzz/src/bin/arrayish.rs b/fuzz/src/bin/arrayish.rs
index 53b2e27..cb0586f 100644
--- a/fuzz/src/bin/arrayish.rs
+++ b/fuzz/src/bin/arrayish.rs
@@ -3,14 +3,14 @@ use arbitrary_model_tests::arbitrary_stateful_operations;
use honggfuzz::fuzz;
use std::{fmt::Debug, iter::FromIterator, ops::{RangeBounds, Bou... | 1 | 3 | 3 |
fd3c92c35109a4b025738fe71bb0fd739c3d6002 | Andreas Molzer | 2020-01-18T12:24:58 | Test and fix removal at past-the-end index | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index b0e68a0..608312c 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -384,12 +384,10 @@ impl<A: Array> ArrayVec<A> {
#[inline]
pub fn remove(&mut self, index: usize) -> A::Item {
let targets: &mut [A::Item] = &mut self.deref_mut()[index..];
- let mut ... | 2 | 11 | 5 |
2d484cbebe1c80c4a8c2b67b053bc869b7f9ae59 | Lokathor | 2020-01-18T06:28:25 | remove the try_push thing | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index fdf9663..949b1ba 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -80,6 +80,19 @@ impl<A: Array, I: SliceIndex<[A::Item]>> IndexMut<I> for ArrayVec<A> {
impl<A: Array> ArrayVec<A> {
/// Move all values from `other` into this vec.
+ ///
+ /// ## Panics
+... | 3 | 28 | 45 |
6afb9103ead42cefb14b2c51dea881c1e6515d37 | Lokathor | 2020-01-18T05:47:53 | breaking: make Array trait follow standard Rust naming | diff --git a/Cargo.toml b/Cargo.toml
index 8ac98a4..8cd927a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.2.0-alpha.0"
+version = "0.3.0-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
edit... | 5 | 63 | 65 |
71eb1a57b95907a87584a24dfc5c8e12c986e496 | James McGlashan | 2020-01-18T00:00:00 | add nightly_const_generics flag | diff --git a/Cargo.toml b/Cargo.toml
index 8cd927a..ee615cf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,9 @@ alloc = []
# https://github.com/rust-lang/rust/issues/54279
nightly_slice_partition_dedup = []
+# use const generics for arrays
+nightly_const_generics = []
+
[badges]
appveyor = { repository = "... | 3 | 23 | 0 |
a59fe3ebc9d7ad929e65dda53fc25cfda84b286e | Lokathor | 2020-01-16T02:45:49 | Update arrayvec.rs | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 22701ee..45c312c 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -19,7 +19,7 @@ use super::*;
macro_rules! array_vec {
($array_type:ty) => {
{
- let mut av: ArrayVec<$array_type> = Default::default();
+ let av: ArrayVec<$array_type> = Default... | 1 | 1 | 1 |
a40793dc010806c488cf083e08d9f0e60ce2bd6c | Sergey "Shnatsel" Davidoff | 2020-01-14T19:24:14 | Editing pass on crate description
I've toned it down a bit, otherwise it feels too confrontational/hostile which may put off some users | diff --git a/src/lib.rs b/src/lib.rs
index 9d32356..2fa19e7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -12,29 +12,28 @@
//!
//! ## What This Is
//!
-//! This crate is a 100% safe code alternative to both
+//! This crate provides 100% safe code alternatives to both
//! [arrayvec](https://docs.rs/arrayvec) and
//! ... | 1 | 15 | 20 |
5e5c0385ccbbbf940045f510b57dcff631cb3710 | Lokathor | 2020-01-14T04:38:15 | doc them nightly methods. | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index 9b39cb3..22701ee 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -138,6 +138,7 @@ impl<A: Array> ArrayVec<A> {
self.truncate(0)
}
+ /// De-duplicates the vec.
#[cfg(feature = "nightly_slice_partition_dedup")]
#[inline(always)]
pub fn dedup(&... | 2 | 7 | 1 |
822b590f4cf101a17db95c3b9fb36684b3f4328a | Lokathor | 2020-01-14T04:34:22 | more docs, more renames, closer to being good. | diff --git a/src/arrayvec.rs b/src/arrayvec.rs
index e8bb2a1..9b39cb3 100644
--- a/src/arrayvec.rs
+++ b/src/arrayvec.rs
@@ -11,12 +11,12 @@ use super::*;
/// ```rust
/// use tinyvec::*;
///
-/// let empty_av = arr_vec!([u8; 16]);
+/// let empty_av = array_vec!([u8; 16]);
///
-/// let some_ints = arr_vec!([i32; 4... | 4 | 50 | 21 |
85377b68152faace3c59e5d73b41bb7ab8b7e82e | Lokathor | 2020-01-14T04:12:04 | rename `arrayish` to `array` I guess
The "ish" part was always supposed to be temporary. | diff --git a/src/arrayish.rs b/src/array.rs
similarity index 58%
rename from src/arrayish.rs
rename to src/array.rs
index d0cbebd..8976918 100644
--- a/src/arrayish.rs
+++ b/src/array.rs
@@ -1,16 +1,21 @@
/// A trait for types that can be the backing store of an
-/// [`ArrayishVec`](ArrayishVec::<A>).
+/// [`ArrayVec`... | 5 | 153 | 137 |
3335c63092abc614f1f8677fc7b2460f3390145d | Wim Looman | 2020-01-13T18:53:01 | Fix TinyVec::resize across inline/heap boundary | diff --git a/src/tiny_vec.rs b/src/tiny_vec.rs
index 25135ea..4d05283 100644
--- a/src/tiny_vec.rs
+++ b/src/tiny_vec.rs
@@ -405,7 +405,12 @@ impl<A: Arrayish> TinyVec<A> {
A::Item: Clone,
{
match self {
- TinyVec::Inline(a) => a.resize(new_len, new_val),
+ TinyVec::Inline(a) => if new_len > A::C... | 2 | 13 | 1 |
4d93c5ce9349fe5b43db0c2fd5ba362f4e3c62be | Wim Looman | 2020-01-13T18:44:04 | Extend methods run through arbitrary-model-tests | diff --git a/fuzz/src/bin/arrayish.rs b/fuzz/src/bin/arrayish.rs
index 9fc5b30..53b2e27 100644
--- a/fuzz/src/bin/arrayish.rs
+++ b/fuzz/src/bin/arrayish.rs
@@ -26,11 +26,16 @@ arbitrary_stateful_operations! {
fn insert(&mut self, index: usize, item: T);
fn is_empty(&self) -> bool;
... | 2 | 27 | 2 |
71ad62a90f2ff95dae4e43d646a55b0329b1eedc | Wim Looman | 2020-01-13T18:42:49 | Fix ArrayishVec::swap_remove for last element | diff --git a/src/arrayish_vec.rs b/src/arrayish_vec.rs
index ee87285..f99955d 100644
--- a/src/arrayish_vec.rs
+++ b/src/arrayish_vec.rs
@@ -538,8 +538,12 @@ impl<A: Arrayish> ArrayishVec<A> {
index,
self.len
);
- let i = self.pop().unwrap();
- replace(&mut self[index], i)
+ if index == self... | 3 | 40 | 2 |
95c991d6b48ca001f505bc9003a8520f26d013e5 | Wim Looman | 2020-01-12T13:07:13 | Fix TinyVec::drain implementation | diff --git a/Cargo.toml b/Cargo.toml
index 4d02844..7544800 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,3 +32,7 @@ all-features = true
[workspace]
members = ["fuzz"]
+
+[[test]]
+name = "tinyvec"
+required-features = ["extern_crate_alloc"]
diff --git a/src/tiny_vec.rs b/src/tiny_vec.rs
index db4e933..25135ea 10... | 3 | 39 | 2 |
16de65055201986cd8bb23b4a4fa4c03e5b04365 | Wim Looman | 2020-01-12T13:03:52 | Add fuzzing of TinyVec as well | diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml
index ef9273b..e73ed6a 100644
--- a/fuzz/Cargo.toml
+++ b/fuzz/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2018"
publish = false
[dependencies]
-tinyvec = { path = "..", features = ["nightly_slice_partition_dedup"] }
+tinyvec = { path = "..", features = ["extern_crate_alloc"... | 2 | 97 | 1 |
9117614aa9d527a122dff8828e56c17d247e3f5a | Wim Looman | 2020-01-12T12:44:53 | Fix ArrayishVec::drain implementation
The end bound was off by one | diff --git a/src/arrayish_vec.rs b/src/arrayish_vec.rs
index 4a78425..ee87285 100644
--- a/src/arrayish_vec.rs
+++ b/src/arrayish_vec.rs
@@ -200,8 +200,8 @@ impl<A: Arrayish> ArrayishVec<A> {
Bound::Unbounded => 0,
};
let end = match range.end_bound() {
- Bound::Included(x) => *x,
- Bound::Ex... | 2 | 32 | 2 |
bb959ae2a3da4cfc687376bd6d93d7f1444b3a32 | Lokathor | 2020-01-12T01:50:00 | be 1.36 compatible | diff --git a/src/tiny_vec.rs b/src/tiny_vec.rs
index 262597e..db4e933 100644
--- a/src/tiny_vec.rs
+++ b/src/tiny_vec.rs
@@ -625,7 +625,7 @@ impl<A: Arrayish> From<ArrayishVec<A>> for TinyVec<A> {
#[inline(always)]
#[must_use]
fn from(arr: ArrayishVec<A>) -> Self {
- Self::Inline(arr)
+ TinyVec::Inline(a... | 1 | 1 | 1 |
f3d85bab8db3b723ba3266b77dceef4a22f51904 | Lokathor | 2020-01-12T01:46:17 | fix all the doc tests | diff --git a/src/tiny_vec.rs b/src/tiny_vec.rs
index 9096ef7..262597e 100644
--- a/src/tiny_vec.rs
+++ b/src/tiny_vec.rs
@@ -195,13 +195,13 @@ impl<A: Arrayish> TinyVec<A> {
/// ## Example
/// ```rust
/// use tinyvec::*;
- /// let mut av = arr_vec!([i32; 4], 1, 2, 3);
- /// let av2: TinyVec<[i32; 4]> = av.dr... | 1 | 40 | 40 |
d6fc14eabd49c15f01e16ab4ab52ebf9cc474e18 | Lokathor | 2020-01-12T01:29:02 | (cargo-release) start next development iteration 0.1.3-alpha.0 | diff --git a/Cargo.toml b/Cargo.toml
index f29dc62..c20a9bc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.1.2"
+version = "0.1.3-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
eeedcad385555fd4a6693a5d61cf02810b6aec96 | Lokathor | 2020-01-12T01:28:56 | (cargo-release) version 0.1.2 | diff --git a/Cargo.toml b/Cargo.toml
index deaba27..f29dc62 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.1.2-alpha.0"
+version = "0.1.2"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
14457a687b0ce377230fe47019b3d22c6f08b288 | Lokathor | 2020-01-12T01:25:31 | add TinyVec type
it builds, but probably isn't optimal! | diff --git a/src/arrayish_vec.rs b/src/arrayish_vec.rs
index 759d977..4a78425 100644
--- a/src/arrayish_vec.rs
+++ b/src/arrayish_vec.rs
@@ -82,17 +82,9 @@ impl<A: Arrayish> ArrayishVec<A> {
/// Move all values from `other` into this vec.
#[inline]
pub fn append(&mut self, other: &mut Self) {
- let final_le... | 2 | 924 | 10 |
d16e60fa18b41e3296c007d55f807f5094accf32 | Wim Looman | 2020-01-11T18:12:27 | Add repository link to crate metadata | diff --git a/Cargo.toml b/Cargo.toml
index c20eb3b..deaba27 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,6 +7,7 @@ edition = "2018"
license = "Zlib"
keywords = ["vec", "no_std", "no-std", "smol"]
categories = ["data-structures", "no-std"]
+repository = "https://github.com/Lokathor/tinyvec"
[dependencies]
# not... | 1 | 1 | 0 |
a631af3588ddf449094069304746a1c1a97c56e9 | Lokathor | 2020-01-10T09:31:38 | (cargo-release) start next development iteration 0.1.2-alpha.0 | diff --git a/Cargo.toml b/Cargo.toml
index 6fd4eb1..c20eb3b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.1.1"
+version = "0.1.2-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
20df1fa5470d752e9c0882621dacd21ca304d15c | Lokathor | 2020-01-10T09:31:33 | (cargo-release) version 0.1.1 | diff --git a/Cargo.toml b/Cargo.toml
index 023a8c7..6fd4eb1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.1.1-alpha.0"
+version = "0.1.1"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
be07a989ba8e943b09df785411727dfd7906a140 | Lokathor | 2020-01-10T09:20:22 | fixed a truncate bug | diff --git a/src/arrayish.rs b/src/arrayish.rs
index d80b618..eb4fcc1 100644
--- a/src/arrayish.rs
+++ b/src/arrayish.rs
@@ -1,4 +1,5 @@
-/// A trait for types that can be the backing store of an [`ArrayishVec`].
+/// A trait for types that can be the backing store of an
+/// [`ArrayishVec`](ArrayishVec::<A>).
///
//... | 3 | 112 | 33 |
ad87000930cdaf8a7e6c5e93294c15125e654048 | Lokathor | 2020-01-10T05:24:12 | (cargo-release) start next development iteration 0.1.1-alpha.0 | diff --git a/Cargo.toml b/Cargo.toml
index f0941a7..023a8c7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.1.0"
+version = "0.1.1-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
0e179473cb966243a019e89bd4cdf802f4d1e936 | Lokathor | 2020-01-10T05:24:05 | (cargo-release) version 0.1.0 | diff --git a/Cargo.toml b/Cargo.toml
index 13be89e..f0941a7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.0.1-alpha.0"
+version = "0.1.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
8be0c601a394a1d756534d90d818d408af52dfa3 | Lokathor | 2020-01-10T05:17:14 | we're calling the ArrayishVec done for now I think | diff --git a/Cargo.toml b/Cargo.toml
index 18a2fd1..13be89e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ categories = ["data-structures", "no-std"]
# not even std!
[features]
-default = ["extern_crate_alloc", "nightly_slice_partition_dedup"]
+default = ["extern_crate_alloc"]
# Provide additional ty... | 4 | 389 | 31 |
15e151243583e5306aae450b6e4173bb40c6fab5 | Lokathor | 2020-01-09T09:04:44 | more stuff | diff --git a/Cargo.toml b/Cargo.toml
index ccee8a1..18a2fd1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,18 +5,23 @@ version = "0.0.1-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2018"
license = "Zlib"
-keywords = ["vec", "no_std", "smol"]
+keywords = ["vec", "no_std", "no-std", "smol"]
categorie... | 3 | 94 | 137 |
3d5e2e011aa744448d827bd39406fed6891514dc | Lokathor | 2020-01-08T23:32:36 | little more | diff --git a/src/arrayish_vec.rs b/src/arrayish_vec.rs
index a221fc4..9e288d7 100644
--- a/src/arrayish_vec.rs
+++ b/src/arrayish_vec.rs
@@ -84,19 +84,33 @@ impl<A: Arrayish> ArrayishVec<A> {
// TODO(Vec): dedup_by_key
// TODO(Vec): drain
// TODO(Vec): drain_filter #nightly
- // TODO(Vec): extend_from_slice
... | 1 | 64 | 31 |
ef39c2ce0e6f9a780244cb3e71e0a7337ec9d908 | Lokathor | 2020-01-08T18:02:15 | simplify formatting | diff --git a/src/arrayish_vec.rs b/src/arrayish_vec.rs
index 0cedb6f..a221fc4 100644
--- a/src/arrayish_vec.rs
+++ b/src/arrayish_vec.rs
@@ -350,19 +350,14 @@ where
A::Item: Binary,
{
fn fmt(&self, f: &mut Formatter) -> core::fmt::Result {
- if self.len == 0 {
- write!(f, "[]")
- } else {
- write... | 1 | 54 | 99 |
20747878df7621c341dbf0854cd796bcac3c1c66 | Lokathor | 2020-01-07T03:46:26 | restore a little more 1.36 stuff | diff --git a/Cargo.toml b/Cargo.toml
index 1d483a2..0a39e7d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
version = "0.0.1-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
-#edition = "2018" # until our min version i... | 2 | 2 | 2 |
2354f8a50365dd750c3153bc159afb30f02514f3 | Lokathor | 2020-01-07T03:36:21 | We need at least rustc 1.28 to use repr transparent. | diff --git a/Cargo.toml b/Cargo.toml
index 77d29bc..e406e20 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,6 +11,10 @@ categories = ["data-structures", "no-std"]
[dependencies]
# not even std!
+[features]
+default = []
+rustc_28 = []
+
[badges]
appveyor = { repository = "Lokathor/tinyvec" }
travis-ci = { reposi... | 2 | 5 | 1 |
d343ee8c14f27c45352b4ed13c8802b01f9512fa | Lokathor | 2020-01-07T03:05:08 | add truncate method and tests based on the Vec examples | diff --git a/src/lib.rs b/src/lib.rs
index fd3e14a..0f07a95 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,6 +5,7 @@
use core::ops::{Deref, DerefMut};
use core::mem::replace;
+use core::mem::needs_drop;
extern crate alloc;
use alloc::vec::Vec;
@@ -113,4 +114,22 @@ impl<T: Default> TinyVec<T> {
}
}
... | 2 | 52 | 3 |
a00370e30e848139321df90925fd87315de92a04 | Lokathor | 2020-01-07T02:30:12 | (cargo-release) start next development iteration 0.0.1-alpha.0 | diff --git a/Cargo.toml b/Cargo.toml
index dbf6914..1708c88 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.0.0"
+version = "0.0.1-alpha.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "2... | 1 | 1 | 1 |
084d2151bdaf820f6938903a6a34e0c3c353d720 | Lokathor | 2020-01-07T02:30:03 | (cargo-release) version 0.0.0 | diff --git a/Cargo.toml b/Cargo.toml
index 8a0c108..dbf6914 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "tinyvec"
description = "Just, really the littlest Vec you could need. So smol."
-version = "0.0.0-alpha"
+version = "0.0.0"
authors = ["Lokathor <zefria@gmail.com>"]
edition = "201... | 1 | 1 | 1 |
f0be99642517c7570169f8d512ed341ec45fd712 | cheeslide | 2025-02-25T14:13:28 | Update utf8_paths | diff --git a/src/lib.rs b/src/lib.rs
index 9be4f61..2328fe2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -57,6 +57,7 @@ where
} else {
let mut ita = path.components();
let mut itb = base.components();
+ let mut comps: Vec<Component> = vec![];
// ./foo and foo are the same
... | 1 | 12 | 2 |
4c35582a9ca76ec225d2e29489062bf8800b27af | cheeslide | 2025-02-23T02:12:32 | fix: start with . (issue #9)
./foo and foo are the same | diff --git a/src/lib.rs b/src/lib.rs
index 34233b3..9be4f61 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -57,6 +57,14 @@ where
} else {
let mut ita = path.components();
let mut itb = base.components();
+
+ // ./foo and foo are the same
+ if let Some(Component::CurDir) = ita.clone().n... | 1 | 17 | 0 |
6e03ead94858f3aeb739478d67a7546dc3719b45 | Kyle Altendorf | 2025-01-17T01:36:24 | follow SPDX for short license text
https://github.com/rust-lang/cargo/issues/2174#issuecomment-355454163 | diff --git a/Cargo.toml b/Cargo.toml
index 46b7e0b..5a1fb71 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ description = "Library for diffing paths to obtain relative paths"
documentation = "https://docs.rs/pathdiff/"
repository = "https://github.com/Manishearth/pathdiff"
keywords = ["path", "relative"]
-l... | 1 | 1 | 1 |
5180ff5b23d9d7eef0a14de13a3d814eb5d8d65c | Manish Goregaokar | 2024-11-25T18:15:13 | Bump to 0.2.3 | diff --git a/Cargo.toml b/Cargo.toml
index 8ae58f3..46b7e0b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pathdiff"
edition = "2018"
-version = "0.2.2"
+version = "0.2.3"
authors = ["Manish Goregaokar <manishsmail@gmail.com>"]
description = "Library for diffing paths to obtain relative... | 1 | 1 | 1 |
0b55ff6450f25247f2acd12c060491c235a98c0b | t4lz | 2024-11-24T19:28:55 | Set doc_cfg on docs.rs builds | diff --git a/src/lib.rs b/src/lib.rs
index d5d5091..34233b3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,6 +11,8 @@
// Adapted from rustc's path_relative_from
// https://github.com/rust-lang/rust/blob/e1d0de82cc40b666b88d4a6d2c9dcbc81d7ed27f/src/librustc_back/rpath.rs#L116-L158
+#![cfg_attr(docsrs, feature(doc_c... | 1 | 2 | 0 |
1439731b7eb2452d9aa1906432899bfbc0fe69aa | Manish Goregaokar | 2024-10-11T18:45:26 | Publish 0.2.2 (docs/tests changes) | diff --git a/Cargo.toml b/Cargo.toml
index ab6a47b..8ae58f3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pathdiff"
edition = "2018"
-version = "0.2.1"
+version = "0.2.2"
authors = ["Manish Goregaokar <manishsmail@gmail.com>"]
description = "Library for diffing paths to obtain relative... | 1 | 1 | 1 |
03cefb549d830047e7a160c62ab191aa8f6bba00 | Manish Goregaokar | 2024-06-12T23:13:21 | remove inconsistent test | diff --git a/src/lib.rs b/src/lib.rs
index 7b374d0..d5d5091 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -27,7 +27,6 @@ use std::path::*;
///
/// assert_eq!(diff_paths("/foo/bar", "baz"), Some("/foo/bar".into()));
/// assert_eq!(diff_paths("/foo/bar", "/baz"), Some("../foo/bar".into()));
... | 1 | 0 | 2 |
e13fdc54d5179ba521a43ef798e2601e84fd8c02 | Rebecca Turner | 2024-06-12T21:59:31 | Add doctests for relative paths | diff --git a/src/lib.rs b/src/lib.rs
index 1d064e1..7b374d0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,6 +25,11 @@ use std::path::*;
/// assert_eq!(diff_paths("/foo/bar/baz", "/foo/bar/quux"), Some("../baz".into()));
/// assert_eq!(diff_paths("/foo/bar", "/foo/bar/quux"), Some("../".into()));
///
+/// ass... | 1 | 10 | 0 |
4ec30a178ec3e2b4f97b0b7069e10cdbcf60c3de | Rebecca Turner | 2024-06-12T21:55:32 | Substitute variables in tests
Having to check exactly what path `bar` and `quux` refer to when reading
the tests makes it challenging to use them as a reference for behavior. | diff --git a/src/lib.rs b/src/lib.rs
index df4bc7d..1d064e1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -19,17 +19,20 @@ use std::path::*;
/// use pathdiff::diff_paths;
/// use std::path::*;
///
-/// let baz = "/foo/bar/baz";
-/// let bar = "/foo/bar";
-/// let quux = "/foo/bar/quux";
-/// assert_eq!(diff_paths(bar,... | 1 | 26 | 20 |
090ed946e061b1c8e0973c540a2d9ded21e93bef | Rain | 2021-12-14T01:05:55 | add note that diff_utf8_paths requires the camino feature | diff --git a/src/lib.rs b/src/lib.rs
index 101650a..df4bc7d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -82,6 +82,8 @@ mod utf8_paths {
/// Construct a relative UTF-8 path from a provided base directory path to the provided path.
///
+ /// Requires the `camino` feature.
+ ///
/// ```rust
///... | 1 | 2 | 0 |
55bbe1b307a0341d747171a7d1b520a2ae24c3f1 | Manish Goregaokar | 2021-09-27T21:36:05 | Bump to 0.2.1 | diff --git a/Cargo.toml b/Cargo.toml
index 601f7e5..5c7ef6b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pathdiff"
edition = "2018"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Manish Goregaokar <manishsmail@gmail.com>"]
description = "Library for diffing paths to obtain relative... | 1 | 1 | 1 |
2602fcd93e3a7957c038dd93db5ef52e95f1d5bc | Manish Goregaokar | 2021-09-27T21:35:51 | Upgrade to Edition 2018 | diff --git a/Cargo.toml b/Cargo.toml
index 8e11d29..601f7e5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "pathdiff"
+edition = "2018"
version = "0.2.0"
authors = ["Manish Goregaokar <manishsmail@gmail.com>"]
description = "Library for diffing paths to obtain relative paths"
diff --git ... | 2 | 2 | 4 |
30bb4010a7f420d8f367b0a0699ca42b813ce73d | Erick Tryzelaar | 2021-05-24T20:28:28 | Add a bunch of test cases to check edge cases | diff --git a/src/lib.rs b/src/lib.rs
index 9dbaaf1..196e8f3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -75,3 +75,69 @@ where
Some(comps.iter().map(|c| c.as_os_str()).collect())
}
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_absolute() {
+ assert_eq!(diff_paths("/f... | 1 | 66 | 0 |
58baa237b2d2b9ac87ad4c47e89608b701ca93e4 | Manish Goregaokar | 2020-04-20T16:49:02 | Bump to 0.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index 2cff898..78ff199 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "pathdiff"
-version = "0.1.0"
+version = "0.2.0"
authors = ["Manish Goregaokar <manishsmail@gmail.com>"]
description = "Library for diffing paths to obtain relative paths"
documenta... | 1 | 1 | 1 |
adb2a69f8dd9447557dfb6a1985f4b8ca6e636d0 | timvisee | 2019-06-20T22:47:53 | Use AsRef<Path> generic for parameters to support broader input types | diff --git a/src/lib.rs b/src/lib.rs
index 8bf1704..9dbaaf1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,28 +13,31 @@
use std::path::*;
-/// Construct a relative path from a provided base directory path to the provided path
+/// Construct a relative path from a provided base directory path to the provided path.... | 1 | 18 | 15 |
b118abd9e42ac80204f25b545638c01db5094d56 | Lukas Kalbertodt | 2025-08-01T12:06:33 | Document semver guarantees regarding parser bugs and rust changes | diff --git a/src/lib.rs b/src/lib.rs
index 7fe95dc..0e76fbd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -129,6 +129,15 @@
//! }
//! ```
//!
+//! # SemVer/Versioning guarantees
+//!
+//! Some technically breaking changes might be released as a minor/patch version
+//! in some situations, for example:
+//! - Bugs in t... | 1 | 9 | 0 |
98f57ac9a7d89e7e1e25157f17111244e31a4430 | Lukas Kalbertodt | 2025-08-01T11:04:42 | Use captured identifiers in format strings for tests
This is only used in test files, so I don't have to bump the MSRV. This
feature was only stabilized in 1.58. | diff --git a/src/float/tests.rs b/src/float/tests.rs
index ecfd2fc..a6455e2 100644
--- a/src/float/tests.rs
+++ b/src/float/tests.rs
@@ -175,7 +175,7 @@ fn non_standard_suffixes() {
let lit = match Literal::parse(input) {
Ok(Literal::Float(f)) => f,
- other => panic!("Expected float l... | 3 | 13 | 33 |
a4a780b27d9dd5baf826d64e39561be09fc00b2d | Lukas Kalbertodt | 2025-08-01T11:03:47 | More rustfmt changes
These ones I can accept tho I don't agree that they are necessarily
better than the previous version. I only did these to be more in line
with rustfmt output. | diff --git a/src/bool/tests.rs b/src/bool/tests.rs
index bda8715..3c6bf98 100644
--- a/src/bool/tests.rs
+++ b/src/bool/tests.rs
@@ -3,7 +3,11 @@ use crate::{test_util::assert_parse_ok_eq, BoolLit, Literal};
macro_rules! assert_bool_parse {
($input:literal, $expected:expr) => {
assert_parse_ok_eq(
- ... | 9 | 75 | 34 |
0971b8fa596318e4ba3549d4d3fc5c9af6ac4d59 | Lukas Kalbertodt | 2025-08-01T10:15:59 | Partially apply rustfmt
Some of these are legit improvements or at least improvements in
consistency. Imports in particular I care very little about, so using
rustfmts formatting is useful. | diff --git a/src/bool/mod.rs b/src/bool/mod.rs
index d7b54a1..db24d64 100644
--- a/src/bool/mod.rs
+++ b/src/bool/mod.rs
@@ -1,6 +1,9 @@
use std::fmt;
-use crate::{ParseError, err::{perr, ParseErrorKind::*}};
+use crate::{
+ err::{perr, ParseErrorKind::*},
+ ParseError,
+};
/// A bool literal: `true` or `... | 23 | 94 | 64 |
26092765931c6ca09cca5bab2adaf75b99723313 | Lukas Kalbertodt | 2025-07-25T17:50:40 | Apply a few clippy suggestions | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index fb0f772..5db964a 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -114,10 +114,10 @@ impl<B: Buffer> fmt::Display for ByteStringLit<B> {
#[inline(never)]
fn parse_impl(input: &str) -> Result<(Option<Vec<u8>>, Option<u8>, usize), ParseError> {
... | 5 | 8 | 8 |
7ac7c350ed7a9004cab03e076fd472ef5fd1141a | Alex Touchet | 2025-07-25T17:43:57 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index aa7e29a..9adb5da 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@ Parse and inspect Rust literals (i.e. tokens in the Rust programming language
representing fixed values). Particularly useful for proc macros, but can also
be used outside of a proc-macro context.
... | 1 | 3 | 3 |
fa92e9bbf4ce4a4b8807027f6efca92ba6900b54 | Lukas Kalbertodt | 2025-07-25T17:41:09 | Remove `proc-macro2` from default features
Closes #12 | diff --git a/Cargo.toml b/Cargo.toml
index 3e5867e..b205bcb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,9 +25,12 @@ exclude = [".github"]
[features]
-default = ["proc-macro2"]
check_suffix = ["unicode-xid"]
[dependencies]
proc-macro2 = { version = "1.0.63", optional = true }
unicode-xid = { version = "0.... | 2 | 8 | 5 |
386e104df8dec4d4f73e79710ed4c6b413c34a89 | Lukas Kalbertodt | 2025-07-25T17:37:38 | Make `into_value()` return `String/Vec<u8>` instead of `Cow`
Fixes #11
I think the more specific type is a tiny bit more useful. Most use
cases (in proc macros) deal with `Lit<String>`, so they just getting
`String` back is neat. I first thought that always getting back the
same type would be nice, but I don't think ... | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index fad836d..fb0f772 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -52,7 +52,7 @@ impl<B: Buffer> ByteStringLit<B> {
/// Like `value` but returns a potentially owned version of the value.
///
- /// The return value is either `Cow<'stati... | 3 | 8 | 8 |
ad4e20f6adfdd1af33badbcc1254ba8ba6e9b07b | Lukas Kalbertodt | 2025-07-25T16:44:33 | Refactor `unescape` to not take `offset` parameter anymore
This was a source of bugs and was not very nice anyway. It was just
used for error spans, which was confusing. This span offsetting is
better done by the calling function, which this commit does. This commit
fixes one bug as well: for `InvalidStartOfUnicodeEsc... | diff --git a/src/byte/mod.rs b/src/byte/mod.rs
index 0757720..2990dde 100644
--- a/src/byte/mod.rs
+++ b/src/byte/mod.rs
@@ -86,7 +86,7 @@ pub(crate) fn parse_impl(input: &str) -> Result<(u8, usize), ParseError> {
b'\'' => return Err(perr(None, EmptyByteLiteral)),
b'\n' | b'\t' | b'\r' => return Err(p... | 4 | 28 | 20 |
d5b00091bc041a3d6911d4d9e49657efa63454d2 | Lukas Kalbertodt | 2025-07-25T16:34:19 | Limit number of # for raw strings to 256 (to align with spec) | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index e0d0450..fad836d 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -23,7 +23,7 @@ pub struct ByteStringLit<B: Buffer> {
/// The number of hash signs in case of a raw string literal, or `None` if
/// it's not a raw string literal.
- num_... | 5 | 17 | 9 |
770b573ceb87c9001fe3fa508527be52e9f34bc4 | Lukas Kalbertodt | 2025-07-25T15:58:58 | Add support for C string literals (and add MSRV to 1.56)
Unfortunately this required more refactoring in `escape.rs`, since
Unicode escapes are allowed for C strings.
Fixes #18 | diff --git a/Cargo.toml b/Cargo.toml
index aa7e29a..3e5867e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,8 +2,8 @@
name = "litrs"
version = "0.4.2"
authors = ["Lukas Kalbertodt <lukas.kalbertodt@gmail.com>"]
-edition = "2018"
-rust-version = "1.54"
+edition = "2021"
+rust-version = "1.56"
description = """
Par... | 13 | 478 | 50 |
8c55d089c61f56209af6373fb98ba3e07c87b0a5 | Lukas Kalbertodt | 2025-07-25T15:35:12 | Fix incorrect error span for out-of-range Unicode escapes | diff --git a/src/char/tests.rs b/src/char/tests.rs
index 19219db..ebf0473 100644
--- a/src/char/tests.rs
+++ b/src/char/tests.rs
@@ -199,7 +199,7 @@ fn invalid_unicode_escapes() {
assert_err!(CharLit, r"'\u{1_23_4_56_7}'", TooManyDigitInUnicodeEscape, 14);
assert_err!(CharLit, r"'\u{abcdef123}'", TooManyDigit... | 3 | 3 | 3 |
8fe855226fa0997c2af969efc939d56d22fe279e | Lukas Kalbertodt | 2025-07-25T14:01:26 | Fix bug with non-ASCII \xHH byte string escapes
The value of the resulting literal would be wrong, as the escaped byte
would incorrectly be converted to a `char` first, and then converted
to UTF-8, before converted back to bytes. So it would always result in
two bytes, instead of one non-ASCII byte. | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index 2bf71ec..60e7154 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -118,7 +118,7 @@ fn parse_impl(input: &str) -> Result<(Option<Vec<u8>>, Option<u32>, usize), Pars
.map(|(num, start_suffix)| (None, Some(num), start_suffix))
} else {... | 3 | 44 | 5 |
ed84018240e4b9a180edebec6b15c40209309fc0 | Lukas Kalbertodt | 2025-07-25T13:07:56 | Refactor escape code to make it more flexible for upcoming c-strings | diff --git a/src/byte/mod.rs b/src/byte/mod.rs
index ffdff5d..1850220 100644
--- a/src/byte/mod.rs
+++ b/src/byte/mod.rs
@@ -85,7 +85,7 @@ pub(crate) fn parse_impl(input: &str) -> Result<(u8, usize), ParseError> {
b'\'' if input_bytes.get(3) == Some(&b'\'') => return Err(perr(2, UnescapedSingleQuote)),
... | 5 | 34 | 17 |
15edbcd13887be5d1719fc2eb72698f9e9e9a8f6 | Lukas Kalbertodt | 2025-07-25T12:44:44 | Remove CR LF normalization to align with spec
The specification now says that CR LF normalization is part of the
pre-processing prior to tokenization. Since it's not part of the lex
grammar, this commit removes it from the parsing code as well. CR are
simply disallowed fully now.
This is technically a breaking change... | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index a0e0972..cf9d416 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -115,7 +115,7 @@ impl<B: Buffer> fmt::Display for ByteStringLit<B> {
fn parse_impl(input: &str) -> Result<(Option<Vec<u8>>, Option<u32>, usize), ParseError> {
if input.starts_wit... | 6 | 27 | 104 |
ba46f309bfc0364b019344971c19ef4dd1349f8b | Lukas Kalbertodt | 2023-10-18T18:50:09 | Add hint to `IntegerLit::value` docs
CC #15 | diff --git a/src/integer/mod.rs b/src/integer/mod.rs
index 2a8d3a2..cecd79d 100644
--- a/src/integer/mod.rs
+++ b/src/integer/mod.rs
@@ -60,6 +60,13 @@ impl<B: Buffer> IntegerLit<B> {
/// method**. This means `N` does not need to match the type suffix!
///
/// Returns `None` if the literal overflows `N`.... | 1 | 7 | 0 |
bd6fae1e394f17639c530a7dd61173ae9a207776 | Lukas Kalbertodt | 2023-10-18T18:45:48 | Fix and clarify docs on `FloatLit`
Closes #14 | diff --git a/src/float/mod.rs b/src/float/mod.rs
index 7e5fa1e..0518633 100644
--- a/src/float/mod.rs
+++ b/src/float/mod.rs
@@ -8,14 +8,15 @@ use crate::{
-/// A floating point literal, e.g. `3.14`, `8.`, `135e12`, `27f32` or `1.956e2f64`.
+/// A floating point literal, e.g. `3.14`, `8.`, `135e12`, or `1.956e2f6... | 1 | 3 | 2 |
1de251d9609fe85195be983b9c1f7ebb8671d4ff | Lukas Kalbertodt | 2023-03-05T16:33:35 | Add "Quick Start" section to the docs | diff --git a/src/lib.rs b/src/lib.rs
index 3d07749..64ed781 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,7 +9,35 @@
//! built. This crate also offers a bit more flexibility compared to `syn`
//! (only regarding literals, of course).
//!
-//! ---
+//!
+//! # Quick start
+//!
+//! | **`StringLit::try_from(tt)?.value... | 1 | 31 | 3 |
618d9a55c2911410ab35e8827e1cffbc5ce8aeb7 | Lukas Kalbertodt | 2023-03-05T15:51:02 | Mark `FloatType` and `IntegerType` as `#[non_exhaustive]`
This is a preparation for v1.0: it's unlikely that new integer or float
types are added to the language anytime soon, but I wouldn't rule it
out. `u128` was added after all. I don't want that to cause a v2.0
release. | diff --git a/src/float/mod.rs b/src/float/mod.rs
index 08a9e8a..7e5fa1e 100644
--- a/src/float/mod.rs
+++ b/src/float/mod.rs
@@ -211,6 +211,7 @@ pub(crate) fn parse_impl(input: &str) -> Result<FloatLit<&str>, ParseError> {
/// All possible float type suffixes.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+#[non_exh... | 2 | 2 | 0 |
ffe81986c8fe694611deace97fa71e565a5154aa | Lukas Kalbertodt | 2023-03-05T15:49:04 | Remove `OwnedLiteral` and `SharedLiteral`
From my GitHub searches and from looking at reverse dependencies, it
seems like no one is using these. Further, it seems weird to have these
type declarations for `Literal` but not for any other specific `*Lit`
types. Very often, specific types are used. Removing these slightl... | diff --git a/src/lib.rs b/src/lib.rs
index 7ebccf4..3d07749 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -157,17 +157,10 @@ pub use self::{
// ===== `Literal` and type defs
// ==============================================================================================
-/// A literal which owns the underlying buffe... | 1 | 2 | 9 |
4fde9a0da0298e641b5f929afc5dfe19bfcd61f4 | Lukas Kalbertodt | 2023-03-05T15:46:43 | Fix typo in docs | diff --git a/src/lib.rs b/src/lib.rs
index bdde6b7..7ebccf4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -279,7 +279,7 @@ impl<B: Buffer> fmt::Display for Literal<B> {
///
/// This is trait is implementation detail of this library, cannot be
/// implemented in other crates and is not subject to semantic versioning.
-... | 1 | 1 | 1 |
83816a8c9639256877a7cf9042d135f59e364556 | Lukas Kalbertodt | 2023-03-05T15:23:49 | Remove extra trailing newline | diff --git a/src/parse.rs b/src/parse.rs
index 62e0e8f..efc6b87 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -123,4 +123,3 @@ pub(crate) fn check_suffix(s: &str) -> Result<(), ParseErrorKind> {
Err(InvalidSuffix)
}
}
- | 1 | 0 | 1 |
3f2d3ee7e877961ad227274568731a72ad20e01e | Lukas Kalbertodt | 2023-03-05T15:20:23 | Add `dbg_and_swallow` macro to example | diff --git a/examples/procmacro/examples/main.rs b/examples/procmacro/examples/main.rs
index 117d816..55ad095 100644
--- a/examples/procmacro/examples/main.rs
+++ b/examples/procmacro/examples/main.rs
@@ -1,4 +1,4 @@
-use procmacro_example::{concat, repeat};
+use procmacro_example::{concat, dbg_and_swallow, repeat};
... | 2 | 10 | 1 |
129c5d77ade932fd4e84091324a6e761f3616cc5 | Lukas Kalbertodt | 2023-03-03T15:59:11 | Move both `Literal` methods to the same impl block
This improves the rendered docs. | diff --git a/src/lib.rs b/src/lib.rs
index b53548d..bdde6b7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -185,6 +185,11 @@ pub enum Literal<B: Buffer> {
}
impl<B: Buffer> Literal<B> {
+ /// Parses the given input as a Rust literal.
+ pub fn parse(input: B) -> Result<Self, ParseError> {
+ parse::parse(in... | 2 | 39 | 37 |
7473861a64ded44249a14d71c38b5f0cc946e324 | Lukas Kalbertodt | 2023-03-03T15:49:09 | Add `Literal::suffix` | diff --git a/src/lib.rs b/src/lib.rs
index ce63987..b53548d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -184,6 +184,57 @@ pub enum Literal<B: Buffer> {
ByteString(ByteStringLit<B>),
}
+impl<B: Buffer> Literal<B> {
+ /// Returns the suffix of this literal or `""` if it doesn't have one.
+ ///
+ /// Rust... | 1 | 51 | 0 |
8f19cd11496d140b5851379281f7a53080188d66 | Lukas Kalbertodt | 2023-03-03T15:35:55 | Allow suffixes for string and byte string literals | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index 904c18d..a0e0972 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -24,6 +24,9 @@ pub struct ByteStringLit<B: Buffer> {
/// The number of hash signs in case of a raw string literal, or `None` if
/// it's not a raw string literal.
num_ha... | 5 | 102 | 50 |
edbbd2e0aa0d17f91a80ccc33c9cda17f94ebd98 | Lukas Kalbertodt | 2023-03-03T14:38:20 | Refactor `parse_impl` of string and byte string
This gets rid of a bit of duplication and might improve compile times
(for the downstream crate) as all string parsing functions are now
compiled once (without generics). | diff --git a/src/bytestr/mod.rs b/src/bytestr/mod.rs
index a2908b9..904c18d 100644
--- a/src/bytestr/mod.rs
+++ b/src/bytestr/mod.rs
@@ -37,7 +37,8 @@ impl<B: Buffer> ByteStringLit<B> {
return Err(perr(None, InvalidByteStringLiteralStart));
}
- Self::parse_impl(input)
+ let (value,... | 3 | 32 | 44 |
14a5225acb151bf4c2e34f188987741bad5a242c | Lukas Kalbertodt | 2023-03-03T13:04:49 | Allow suffixes for byte and char literals | diff --git a/src/byte/mod.rs b/src/byte/mod.rs
index 7c64901..ffdff5d 100644
--- a/src/byte/mod.rs
+++ b/src/byte/mod.rs
@@ -4,6 +4,7 @@ use crate::{
Buffer, ParseError,
err::{perr, ParseErrorKind::*},
escape::unescape,
+ parse::check_suffix,
};
@@ -15,6 +16,8 @@ use crate::{
#[derive(Debug, Clo... | 4 | 104 | 65 |
80c354a88dc1481db39a6b92132eeb8187ffc1cf | Lukas Kalbertodt | 2023-03-03T11:26:47 | Rewrite integer and float literals to accept any suffix
This is quite a big change. Its main motivation is to allow for
arbitrary suffixes, as allowed by the grammar (e.g. `23px`). This
required the following changes:
- Replace method `type_suffix` by `suffix(&self) -> &str`. Users are
expected to use `{Integer|Flo... | diff --git a/Cargo.toml b/Cargo.toml
index bbfd540..46d41b5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,6 +26,8 @@ exclude = [".github"]
[features]
default = ["proc-macro2"]
+check_suffix = ["unicode-xid"]
[dependencies]
proc-macro2 = { version = "1", optional = true }
+unicode-xid = { version = "0.2.4", op... | 9 | 280 | 196 |
bdbe75a5eb20859308f97dc6aafee0c612a27432 | Lukas Kalbertodt | 2023-03-03T10:25:59 | Add `value` to `IntegerBase` | diff --git a/src/integer/mod.rs b/src/integer/mod.rs
index bacc187..5da6ad5 100644
--- a/src/integer/mod.rs
+++ b/src/integer/mod.rs
@@ -34,14 +34,6 @@ pub struct IntegerLit<B: Buffer> {
type_suffix: Option<IntegerType>,
}
-/// The bases in which an integer can be specified.
-#[derive(Debug, Clone, Copy, Partia... | 1 | 32 | 14 |
3f3e2739dcee224255ea541aa387458c57aae0bd | Lukas Kalbertodt | 2023-03-03T10:25:23 | Add `from_suffix`, `suffix`, `FromStr` and `Display` to float/int types
Just two methods and two trait impls for `IntegerType` and `FloatType` | diff --git a/src/float/mod.rs b/src/float/mod.rs
index b196845..5eb9f8d 100644
--- a/src/float/mod.rs
+++ b/src/float/mod.rs
@@ -1,4 +1,4 @@
-use std::fmt;
+use std::{fmt, str::FromStr};
use crate::{
Buffer, ParseError,
@@ -57,13 +57,6 @@ pub struct FloatLit<B: Buffer> {
type_suffix: Option<FloatType>,
}
... | 2 | 118 | 40 |
440975947305406697c8b4953cb1b3a458e9ee26 | Lukas Kalbertodt | 2023-01-15T15:06:33 | Wrap too long lines | diff --git a/src/tests.rs b/src/tests.rs
index 526917e..039aa56 100644
--- a/src/tests.rs
+++ b/src/tests.rs
@@ -113,7 +113,11 @@ fn proc_macro() {
($input:expr, expected: $expected:path, actual: $actual:path $(,)?) => {
let err = $input.unwrap_err();
if err.expected != $expected {
- ... | 1 | 9 | 2 |
f38decc7253efed79c0015d7f11464d8bfb4212e | Lukas Kalbertodt | 2022-12-19T14:16:03 | Fix tests to compile without `proc-macro2` feature | diff --git a/src/test_util.rs b/src/test_util.rs
index b156e27..fd284e9 100644
--- a/src/test_util.rs
+++ b/src/test_util.rs
@@ -1,5 +1,5 @@
use crate::*;
-use std::{fmt::{Debug, Display}, convert::TryFrom};
+use std::fmt::{Debug, Display};
#[track_caller]
@@ -39,12 +39,18 @@ pub(crate) fn assert_parse_ok_eq<T: P... | 1 | 9 | 3 |
70e55b72edd39e3a955c22e81046e655d43dc892 | Lukas Kalbertodt | 2022-12-19T14:01:22 | Add `rust_version` to `Cargo.toml` (it's currently 1.54) | diff --git a/Cargo.toml b/Cargo.toml
index 9adec4c..6e5d2eb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ name = "litrs"
version = "0.2.3"
authors = ["Lukas Kalbertodt <lukas.kalbertodt@gmail.com>"]
edition = "2018"
+rust-version = "1.54"
description = """
Parse and inspect Rust literals (i.e. tokens ... | 1 | 1 | 0 |
88c95b9b5f79c1b925cc7047cb1086748718fe84 | Lukas Kalbertodt | 2022-12-19T13:44:11 | Add `inline(always)` to some trivial methods that weren't inlined | diff --git a/src/err.rs b/src/err.rs
index dd5b472..1011550 100644
--- a/src/err.rs
+++ b/src/err.rs
@@ -180,16 +180,19 @@ pub(crate) trait SpanLike {
}
impl SpanLike for Option<Range<usize>> {
+ #[inline(always)]
fn into_span(self) -> Option<Range<usize>> {
self
}
}
impl SpanLike for Range<... | 1 | 3 | 0 |
271ac5782cabf3f3ea418ae71b103fbf966d17e9 | Lukas Kalbertodt | 2022-12-19T13:43:57 | Move lots of parsing code into non-generic functions
This should improve compile times as the main logic can be compiled
once (when you see "Compiling litrs") and not as part of your crate's
instantiation. The latter should be dealt with by incremental
compilation, but it's not always perfect and generally this change... | diff --git a/src/byte/mod.rs b/src/byte/mod.rs
index 273230d..7c64901 100644
--- a/src/byte/mod.rs
+++ b/src/byte/mod.rs
@@ -29,7 +29,8 @@ impl<B: Buffer> ByteLit<B> {
return Err(perr(None, InvalidByteLiteralStart));
}
- Self::parse_impl(input)
+ let value = parse_impl(&input)?;
+ ... | 6 | 251 | 213 |
e9aec00cb7a1d167c402e8b0a1c75c376c9f29c4 | Lukas Kalbertodt | 2021-12-30T13:51:41 | Add `impl From<BoolLit> for pm::Ident` | diff --git a/src/impls.rs b/src/impls.rs
index 197bf1a..61a314d 100644
--- a/src/impls.rs
+++ b/src/impls.rs
@@ -241,6 +241,22 @@ macro_rules! impl_from_tt_for_bool {
helper!(impl_from_tt_for_bool, );
+// ==============================================================================================
+// ===== `From... | 1 | 16 | 0 |
95af31786f5b3f0cd18668cc25b22cb2f1841410 | Lukas Kalbertodt | 2021-12-30T13:46:49 | Implement `From<*Lit> for pm::Literal` (for non-bool literals) | diff --git a/src/byte/tests.rs b/src/byte/tests.rs
index 5f663ce..08586b0 100644
--- a/src/byte/tests.rs
+++ b/src/byte/tests.rs
@@ -1,4 +1,4 @@
-use crate::{ByteLit, Literal, test_util::assert_parse_ok_eq};
+use crate::{ByteLit, Literal, test_util::{assert_parse_ok_eq, assert_roundtrip}};
// ===== Utility functions... | 8 | 103 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.