clockworklabs / clockworklabs/SpacetimeDB

Feature Request: Adding `Iterator::size_hint()` to `TableIter`

Open
#4,645 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

Random sampling or certain optimizations would be improved by either exposing a capacity() method on TableIter or implementing size_hint() from the Iterator trait. From what I can tell, it would be as simple as using the internal cursor and adding it as both the upper and lower bounds of the size_hint(), and I would be happy to submit a PR.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TableIter implementation and its Iterator trait implementation, then inspect how the internal cursor represents remaining rows. The change is done when the iterator exposes an accurate lower and upper size bound for the remaining entries, with relevant tests passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.