Skip to content

walk: remaining_count should decrement loudly, not saturate #55

Description

@armcconnell

From review of #49.

Messages::remaining_count uses saturating_sub, but it no longer governs termination — next stops on offset — so it only feeds size_hint, and Messages implements ExactSizeIterator.

If the declared Message Count and the boundary walk ever disagreed, len() would quietly return the wrong number instead of failing. Datagram::decode enforces found == msg_count so they cannot disagree today; a plain -= 1 would keep it that way loudly if that ever changed.

One line, on main, so it is separate from the stack rather than widening a PR.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions