Skip to content

v0.2.20

Choose a tag to compare

@zhuxiujia zhuxiujia released this 18 Aug 16:28
· 15 commits to main since this release

This release fixes API regressions introduced by the lock-free redesign in v0.2.17, so downstream crates (e.g. rbatis, fast_log) build again without source
changes. It also makes read iterators Send, so they can be held across .await inside async runtimes.

Fixed

  • SyncVec::iter() is now Send. VecIter<'a, V> is Send when V: Sync. Previously the iterator carried an explicit !Send marker (*const ()), which made any future
    holding it across an .await fail to compile with future cannot be sent between threads safely (e.g. the rbatis 4.9.7 executor).

  • Restored IntoIterator for shared references on all four containers:

    • &SyncVec → &V
    • &SyncBtreeMap, &SyncHashMap, &SyncIndexMap → (&K, &V)

    This restores the for x in &v / for (k, v) in &m patterns and fixes fast_log's for x in &self.modules.

  • Restored Index for SyncVec (e.g. rb.intercepts[0]), used by rbatis.

  • Restored Index<&K> for SyncBtreeMap, SyncHashMap, and SyncIndexMap (e.g. m[&k]).

  • Restored Deref/DerefMut on the iter_mut() iterators (VecIterMut, BtreeMapIterMut, HashMapIterMut, IndexMapIterMut), so the underlying slice/map iterator API
    is available again.

  • Restored SyncVec::get_uncheck (unsafe index access, pre-0.2.17 API).

Notes / Breaking changes carried over from v0.2.17

  • Index and get_uncheck follow the same contract as the pre-0.2.17 API: the returned reference is valid only while no concurrent write mutates the container.
    Prefer get() / iter(), which pin a reader slot and are safe against concurrent writers.

  • get() and dirty_ref() return guards (ReadGuard / ReadMapGuard) as introduced in v0.2.17. Typical deref-based usage (*g, dirty_ref().len()) remains source-
    compatible.

Tests

  • Added regression and unit tests for every restored API, including a tokio test that iterates a SyncVec across an .await inside a spawned task (verifying the
    Send requirement).