Merge pull request #460 from Tuetuopay/owned-per-cpu-hash-map

maps: add missing TryFrom<Map> for HashMap, PerCpuHashMap and LpmTrie
pull/463/head
Alessandro Decina 2 years ago committed by GitHub
commit 66d435fc7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -412,8 +412,19 @@ macro_rules! impl_try_from_map_generic_key_and_value {
$ty::new(m) $ty::new(m)
}, },
_ => Err(MapError::InvalidMapType{ map_type: map.map_type()}), _ => Err(MapError::InvalidMapType{ map_type: map.map_type()}),
}
} }
} }
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