/// The `view` function and the `Hash` implementation of `View` should satisfy:
/// ```
/// view(key).hash() == key.hash()
/// ```
fn get_by_view[K, View : Hash + Eq, Value](
self : Self[K, Value],
key : View,
view~ : (K) -> View
) -> Value?
It is hard to reason about if the variant is met or not. for String, we added an optimization that "abc"[:].to_string() does not allocate, maybe we can add a special function:
Map[String]::get_from_string(self : Self, StringView)
Map[Bytes]::get_from_bytes(self : Self, BytesView)
Originally posted by @bobzhang in #2082 (comment)