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

Method with_capacity

crates/core/src/alloc/string.rs:144–148  ·  view source on GitHub ↗
(capacity: usize)

Source from the content-addressed store, hash-verified

142 /// allocation failure.
143 #[inline]
144 pub fn with_capacity(capacity: usize) -> Result<Self, OutOfMemory> {
145 let mut s = Self::new();
146 s.reserve(capacity)?;
147 Ok(s)
148 }
149
150 /// Same as [`std::string::String::capacity`].
151 #[inline]

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
newFunction · 0.50
reserveMethod · 0.45

Tested by

no test coverage detected