@@ -1003,11 +1003,11 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv4RouteTargetNlri<Octs> {
1003
1003
1004
1004
//--- Ipv4FlowSpec
1005
1005
1006
- #[ derive( Clone , Debug , Hash ) ]
1006
+ #[ derive( Clone , Hash ) ]
1007
1007
#[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
1008
1008
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
1009
1009
#[ cfg_attr( feature = "bincode" , derive( bincode:: Decode , bincode:: Encode ) ) ]
1010
- pub struct Ipv4FlowSpecNlri < Octs > ( FlowSpecNlri < Octs > ) ;
1010
+ pub struct Ipv4FlowSpecNlri < Octs > ( pub FlowSpecNlri < Octs > ) ;
1011
1011
1012
1012
impl < Octs > AfiSafiNlri for Ipv4FlowSpecNlri < Octs > {
1013
1013
type Nlri = FlowSpecNlri < Octs > ;
@@ -1048,10 +1048,12 @@ impl<Octs: AsRef<[u8]>> NlriCompose for Ipv4FlowSpecNlri<Octs> {
1048
1048
}
1049
1049
}
1050
1050
1051
- impl < T > From < Ipv4FlowSpecNlri < T > > for FlowSpecNlri < T > {
1052
- fn from ( value : Ipv4FlowSpecNlri < T > ) -> Self {
1053
- value. 0
1054
- }
1051
+ impl < ' a , O : Octets + ' a > From < & ' a Ipv4FlowSpecNlri < O > > for FlowSpecNlri < bytes:: Bytes > {
1052
+ fn from ( value : & Ipv4FlowSpecNlri < O > ) -> Self {
1053
+ let raw = bytes:: Bytes :: copy_from_slice ( value. 0 . raw ( ) . as_ref ( ) ) ;
1054
+ let p = & mut Parser :: from_ref ( & raw ) ;
1055
+ FlowSpecNlri :: parse ( p, Afi :: Ipv4 ) . unwrap ( )
1056
+ }
1055
1057
}
1056
1058
1057
1059
impl < Octs , Other > PartialEq < Ipv4FlowSpecNlri < Other > > for Ipv4FlowSpecNlri < Octs >
@@ -1086,6 +1088,12 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv4FlowSpecNlri<Octs> {
1086
1088
}
1087
1089
}
1088
1090
1091
+ impl < T > Debug for Ipv4FlowSpecNlri < T > {
1092
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1093
+ write ! ( f, "{}" , self . nlri( ) )
1094
+ }
1095
+ }
1096
+
1089
1097
//------------ Ipv6 ----------------------------------------------------------
1090
1098
1091
1099
//--- Ipv6Unicast
@@ -1378,11 +1386,11 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv6MplsVpnUnicastNlri<Octs> {
1378
1386
1379
1387
//--- Ipv6FlowSpec
1380
1388
1381
- #[ derive( Clone , Debug , Hash ) ]
1389
+ #[ derive( Clone , Hash ) ]
1382
1390
#[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
1383
1391
#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
1384
1392
#[ cfg_attr( feature = "bincode" , derive( bincode:: Decode , bincode:: Encode ) ) ]
1385
- pub struct Ipv6FlowSpecNlri < Octs > ( FlowSpecNlri < Octs > ) ;
1393
+ pub struct Ipv6FlowSpecNlri < Octs > ( pub FlowSpecNlri < Octs > ) ;
1386
1394
1387
1395
impl < Octs > AfiSafiNlri for Ipv6FlowSpecNlri < Octs > {
1388
1396
type Nlri = FlowSpecNlri < Octs > ;
@@ -1461,6 +1469,12 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv6FlowSpecNlri<Octs> {
1461
1469
}
1462
1470
}
1463
1471
1472
+ impl < T > Debug for Ipv6FlowSpecNlri < T > {
1473
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
1474
+ write ! ( f, "{}" , self . nlri( ) )
1475
+ }
1476
+ }
1477
+
1464
1478
/*
1465
1479
impl Ipv6UnicastAddpathNlri {
1466
1480
pub fn iter<'a, O, P>(parser: Parser<'a, P>) -> NlriIter<'a, O, P, Self>
0 commit comments