Copies `string` into the arena and returns a reference valid for its lifetime.
(&'a self, string: String)
| 3162 | |
| 3163 | /// Copies `string` into the arena and returns a reference valid for its lifetime. |
| 3164 | pub fn push_string<'a>(&'a self, string: String) -> &'a str { |
| 3165 | let copied = self.push_bytes(string.as_bytes()); |
| 3166 | unsafe { |
| 3167 | // This is safe because we just copied the bytes of a valid `String`. |
| 3168 | std::str::from_utf8_unchecked(copied) |
| 3169 | } |
| 3170 | } |
| 3171 | |
| 3172 | /// Returns a growable, writeable byte buffer for assembling a value incrementally. |
| 3173 | /// |