Like `with_capacity` but returns an error on allocation failure.
(capacity: usize)
| 60 | |
| 61 | /// Like `with_capacity` but returns an error on allocation failure. |
| 62 | pub fn try_with_capacity(capacity: usize) -> Result<Self, OutOfMemory> { |
| 63 | let mut map = Self::new(); |
| 64 | map.try_reserve(capacity)?; |
| 65 | Ok(map) |
| 66 | } |
| 67 | |
| 68 | /// Check if `k` is a valid key in the map. |
| 69 | pub fn is_valid(&self, k: K) -> bool { |
nothing calls this directly
no test coverage detected