3 ms·
> get(key: K) -> Option<V> This is also not clear whether the value is missing because it's not set or because it's set to nothing You might want > get(key:
by 8note 5y ago
> get(key: K) -> Option<V>
This is also not clear whether the value is missing because it's not set or because it's set to nothing
You might want
> get(key: K) -> Option<Option<V>>
? But you can do that with nulls too, just a matter of having a box around the value
- ebingdom 5y agoNo, the type for `get` would only have a single layer of `Option`. But V is a type parameter, so you can instantiate it with another layer of Option. You don't need to (and shouldn't) modify the type signature of the `get` method. It's already generic.