(u32) as Hashmap key

In my application there are different IDs, e.g. local_tunnel_id, remote_tunnel_id . their types are u32

And I have HashMap to store them by key.

local_tunnels : HashMap<u32 /* local tunnel id */, Arc<Tunnel>>,
remote_tunnels : HashMap<u32 /* remote tunnel id */, Arc<Tunnel>>,

The problem is that -- it is easy to make mistake. e.g. passing a local tunnel id to a method where remote tunnel id is expected. This error cannot be detected by complier because their type are the same.

Hence, I am thinking about defining dedicated type per each kind of ID in order to prevent this error in compliation time.

#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub struct LocalTunnelID(pub u32);

#[derive(PartialEq, Eq, Hash, Clone, Copy)]
pub struct RemoteTunnelID(pub u32);

My question: can LocalTunnelID or RemoteTunnelID be defined as HashMap's key below?

local_tunnels : HashMap<LocalTunnelID, Arc<Tunnel>>,
remote_tunnels : HashMap<RemoteTunnelID, Arc<Tunnel>>,

Their Hash trait will work in the same way as u32?

Thank you

Yes, the work the same as a u32