Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
+ Coverage 74.78% 76.91% +2.12%
==========================================
Files 63 66 +3
Lines 15062 17049 +1987
==========================================
+ Hits 11264 13113 +1849
- Misses 3798 3936 +138 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
442576d to
52e8733
Compare
There was a problem hiding this comment.
Pull request overview
Adds a “leveled” MQTT parsing mode to support parsing packets at different depths (type-only, raw body, headers-only, or full), enabling consumers to trade parsing cost for throughput.
Changes:
- Introduces
parser::leveledwithParseLevel,ParsedPacket, and level-specific parse functions. - Extends
MqttParserwithparse_levelconfiguration and a newnext_parsed()API. - Adds
ControlPacketType::from_first_byte()andMqttPacket::packet_type()helpers used by the leveled parser.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mqtt_serde/parser/stream.rs | Adds parse-level configuration and next_parsed() to the streaming parser. |
| src/mqtt_serde/parser/mod.rs | Exposes the new leveled parser module. |
| src/mqtt_serde/parser/leveled.rs | Implements leveled parsing (L0–L3) plus unit tests. |
| src/mqtt_serde/mod.rs | Re-exports ParseLevel from the crate root. |
| src/mqtt_serde/control_packet.rs | Adds helpers to extract/control packet type information. |
| mqtt_grpc_duality/src/bin/r-proxy.rs | Removes stray whitespace in imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ParsedPacket::HeadersParsed(HeadersParsedPacket { | ||
| packet_type: pkt_type, | ||
| flags, | ||
| mqtt_version: 4, | ||
| variable_header, | ||
| raw_payload, | ||
| }), |
There was a problem hiding this comment.
parse_headers_only() routes both MQTT v3.1 (3) and v3.1.1 (4) to parse_headers_only_v3, but the returned HeadersParsedPacket hard-codes mqtt_version: 4. This misreports the negotiated protocol version when parsing v3.1 packets. Consider passing the input mqtt_version through (or storing 3 vs 4 based on the caller) instead of always using 4.
…unctions for zero-copy usage
…rse_connack_header_v5
…eason code and properties
Description
Please include a summary of the changes and which issue is fixed. Please also include relevant motivation and context.
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Checklist:
Performance Impact
Security Considerations