Skip to content

Commit 6dd74c9

Browse files
committed
Implement Display for VxlanDf
Signed-off-by: Gris Ge <cnfourt@gmail.com>
1 parent 2fac888 commit 6dd74c9

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/link/link_info/vxlan.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// SPDX-License-Identifier: MIT
22

3-
use std::net::{Ipv4Addr, Ipv6Addr};
3+
use std::{
4+
fmt,
5+
net::{Ipv4Addr, Ipv6Addr},
6+
};
47

58
use netlink_packet_core::{
69
emit_u16_be, emit_u32, emit_u64_be, parse_u16_be, parse_u32, parse_u64_be,
@@ -65,6 +68,17 @@ impl From<u8> for VxlanDf {
6568
}
6669
}
6770

71+
impl fmt::Display for VxlanDf {
72+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
73+
match self {
74+
VxlanDf::Unset => write!(f, "unset"),
75+
VxlanDf::Set => write!(f, "set"),
76+
VxlanDf::Inherit => write!(f, "inherit"),
77+
VxlanDf::Other(v) => write!(f, "{v}"),
78+
}
79+
}
80+
}
81+
6882
impl From<VxlanDf> for u8 {
6983
fn from(d: VxlanDf) -> Self {
7084
match d {

0 commit comments

Comments
 (0)