MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / try_with_capacity

Method try_with_capacity

cranelift/entity/src/primary.rs:62–66  ·  view source on GitHub ↗

Like `with_capacity` but returns an error on allocation failure.

(capacity: usize)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
try_reserveMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected