Skip to content

feat: weak ref#8

Merged
George-Miao merged 1 commit intocompio-rs:mainfrom
George-Miao:feat/weak-ref
Apr 14, 2026
Merged

feat: weak ref#8
George-Miao merged 1 commit intocompio-rs:mainfrom
George-Miao:feat/weak-ref

Conversation

@George-Miao
Copy link
Copy Markdown
Member

No description provided.

@George-Miao George-Miao requested a review from Berrysoft April 13, 2026 04:38
@George-Miao George-Miao self-assigned this Apr 13, 2026
@George-Miao George-Miao added the enhancement New feature or request label Apr 13, 2026
@George-Miao George-Miao force-pushed the feat/weak-ref branch 2 times, most recently from 81ca592 to 3cd0737 Compare April 13, 2026 04:42
Berrysoft
Berrysoft previously approved these changes Apr 13, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional weak feature to ThinCell (sync + unsync) to support non-owning Weak<T> handles, including separate strong/weak refcount tracking and accompanying tests/docs.

Changes:

  • Introduces Weak<T> plus ThinCell::{downgrade,strong_count,weak_count} behind cfg(feature = "weak").
  • Refactors refcount state representation to track strong + weak counts (and updates state tests).
  • Adds sync weak-reference tests and updates CI/docs to build & test with all features.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/lib.rs Adds Weak<T> API and weak-aware drop/upgrade logic.
src/state/mod.rs Adds strong/weak bit layout and weak-aware Snapshot helpers.
src/state/macros.rs Implements strong/weak refcount ops (inc_weak, try_inc, dec_weak, etc.) and weak-specific tests.
src/sync/mod.rs Adds Send/Sync impls for Weak<T> under the feature flag.
tests/sync.rs Adds weak-gated multithreaded tests for downgrade/upgrade/count behavior.
README.md Documents the new weak feature and provides an example.
Cargo.toml Defines the weak feature and enables docs.rs all-features docs build.
.github/workflows/ci_test.yml Runs cargo test --all-features in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@George-Miao George-Miao merged commit c6b8989 into compio-rs:main Apr 14, 2026
4 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants