(capacity: usize)
| 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] |