link: add Display + FromStr impls for bridge enums#267
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #267 +/- ##
==========================================
+ Coverage 68.10% 68.67% +0.56%
==========================================
Files 144 146 +2
Lines 10103 10525 +422
==========================================
+ Hits 6881 7228 +347
- Misses 3222 3297 +75 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request implements 'std::fmt::Display' and 'std::str::FromStr' for several bridge-related enums ('BridgeFlag', 'BridgeMode', 'BridgeStpState', 'BridgeMulticastRouterType', 'BridgePortState', and 'VlanProtocol'). The reviewer suggests improving the 'Display' and 'FromStr' implementations for the bridge enums to ensure correct round-tripping of their 'Other' variants by parsing fallback values. Additionally, for 'VlanProtocol', the reviewer recommends using 'eq_ignore_ascii_case' instead of 'to_lowercase()' to prevent unnecessary heap allocations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Add Display and FromStr implementations for bridge-related enums
to eliminate manual parsing/formatting in downstream crates:
BridgeStpState Display: "no"/"kernel_stp"/"user_stp"
FromStr: accepts name and numeric ("0"/"1"/"2")
BridgeMulticastRouterType Display: "disabled"/"auto"/"permanent"/"temp"
FromStr: accepts name and numeric
BridgePortState Display: "disabled"/"listening"/"learning"/
"forwarding"/"blocking"
FromStr: accepts string names
BridgeFlag Display: "master"/"self"
FromStr: accepts string names
BridgeMode Display: "veb"/"vepa"
FromStr: accepts string names
VlanProtocol FromStr: case-insensitive "802.1q"/"802.1ad"
(Display already existed)
Other(d) variants produce raw numeric values matching iproute2 output.
Signed-off-by: Gris Ge <cnfourt@gmail.com>
Add Display and FromStr implementations for bridge-related enums
to eliminate manual parsing/formatting in downstream crates:
Other(d) variants produce raw numeric values matching iproute2 output.