maps: add missing TryFrom<Map> for HashMap, PerCpuHashMap and LpmTrie

pull/460/head
Alexis Bauvin 2 years ago
parent 16b029ed37
commit 51bb50ed8e

@ -415,6 +415,17 @@ macro_rules! impl_try_from_map_generic_key_and_value {
} }
} }
} }
impl<V: Pod, K: Pod> TryFrom<Map> for $ty<MapData, V, K> {
type Error = MapError;
fn try_from(map: Map) -> Result<$ty<MapData, V, K>, MapError> {
match map {
Map::$ty(m) => $ty::new(m),
_ => Err(MapError::InvalidMapType { map_type: map.map_type() }),
}
}
}
)+ )+
} }
} }

Loading…
Cancel
Save