Document method enum indexing invariant#180
Closed
Copilot wants to merge 2 commits into
Closed
Conversation
Document that method enum constants start at 0 and increment by 1, making them suitable for use as indexes into a compact array. Co-authored-by: vinniefalco <1503976+vinniefalco@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update documentation for http_proto::method enumeration
Document method enum indexing invariant
Oct 13, 2025
vinniefalco
requested changes
Oct 13, 2025
| Each item corresponds to a particular method string | ||
| used in HTTP request messages. | ||
|
|
||
| @par Enumeration Constants |
Member
There was a problem hiding this comment.
rename this section to simply "Values"
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #180 +/- ##
========================================
Coverage 92.48% 92.48%
========================================
Files 71 71
Lines 4854 4854
========================================
Hits 4489 4489
Misses 365 365 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Collaborator
|
Addressed in #188. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds documentation to the
http_proto::methodenumeration to explicitly state an important invariant: that the enumeration constants begin at 0 and increment by 1, making them suitable for use as indexes into compact arrays.Changes
Updated the documentation comment for
enum class methodininclude/boost/http_proto/method.hppto include a new@par Enumeration Constantssection that guarantees:method::unknown) starts at 0Example Use Case
With this documented guarantee, users can now confidently write code like:
Verification
The enumeration values were verified to follow this invariant:
method::unknown = 0method::delete_ = 1method::get = 2method::unlink = 33All 34 constants are sequential with no gaps.
Impact
This is a documentation-only change with no modifications to code or enum values. The invariant has always been true for this enum; this PR simply documents the guarantee for library users.
Fixes #[issue_number]
Original prompt
Fixes #179
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.