From bd5c42720b42af6323c8e4e0c4021c941606238c Mon Sep 17 00:00:00 2001 From: Gris Ge Date: Sun, 24 May 2026 11:12:57 +0800 Subject: [PATCH] Implement Display for VxlanDf Signed-off-by: Gris Ge --- src/link/link_info/vxlan.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/link/link_info/vxlan.rs b/src/link/link_info/vxlan.rs index bf8b6b2e..4a3df824 100644 --- a/src/link/link_info/vxlan.rs +++ b/src/link/link_info/vxlan.rs @@ -1,6 +1,9 @@ // SPDX-License-Identifier: MIT -use std::net::{Ipv4Addr, Ipv6Addr}; +use std::{ + fmt, + net::{Ipv4Addr, Ipv6Addr}, +}; use netlink_packet_core::{ emit_u16_be, emit_u32, emit_u64_be, parse_u16_be, parse_u32, parse_u64_be, @@ -65,6 +68,17 @@ impl From for VxlanDf { } } +impl fmt::Display for VxlanDf { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + VxlanDf::Unset => write!(f, "unset"), + VxlanDf::Set => write!(f, "set"), + VxlanDf::Inherit => write!(f, "inherit"), + VxlanDf::Other(v) => write!(f, "{v}"), + } + } +} + impl From for u8 { fn from(d: VxlanDf) -> Self { match d {