Skip to content

feat(data-structures/unstable): add Readonly view and clone path to RollingCounter#7161

Open
tomas-zijdemans wants to merge 1 commit into
denoland:mainfrom
tomas-zijdemans:rolling-counter-ready
Open

feat(data-structures/unstable): add Readonly view and clone path to RollingCounter#7161
tomas-zijdemans wants to merge 1 commit into
denoland:mainfrom
tomas-zijdemans:rolling-counter-ready

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

Two additive changes, each adopting a pattern already used by sibling data structures.

  • Add ReadonlyRollingCounter, a Pick<> view of the non-mutating members. RollingCounter now implements ReadonlyRollingCounter for a compile-time guarantee. Matches ReadonlyDeque and ReadonlyIndexedHeap.
  • Widen RollingCounter.from() to accept a RollingCounter in addition to a RollingCounterSnapshot. The instance path produces an independent clone with a canonical layout (segments oldest-to-newest, cursor at the last position). Matches Deque.from(deque) and IndexedHeap.from(otherHeap).

No behavior changes for existing call sites.

@tomas-zijdemans tomas-zijdemans changed the title feat(data-structures/unstable): add Readonly view and clone path to ´RollingCounter´ feat(data-structures/unstable): add Readonly view and clone path to RollingCounter May 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.57%. Comparing base (f0c9f14) to head (55d1f71).

Files with missing lines Patch % Lines
data_structures/unstable_rolling_counter.ts 95.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7161      +/-   ##
==========================================
- Coverage   94.57%   94.57%   -0.01%     
==========================================
  Files         636      636              
  Lines       52138    52152      +14     
  Branches     9399     9404       +5     
==========================================
+ Hits        49311    49324      +13     
  Misses       2249     2249              
- Partials      578      579       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant