0
votes

I have a hashmap of type HashMap<String, &[T]>.

Calling hashmap.get(&key), returns an Option<&&[T]>. [Double ampersand]

How do I convert that to Option<&[T]>? [Single ampersand]

1

1 Answers

1
votes

All & references are Copy, so you can use Option::copied:

hashmap.get(&key).copied()