Write the string `str` to the var-len section and a `VarLenRef` to the fixed buffer and advance the `curr_offset`.
(&mut self, val: &str)
| 325 | /// Write the string `str` to the var-len section |
| 326 | /// and a `VarLenRef` to the fixed buffer and advance the `curr_offset`. |
| 327 | fn write_string(&mut self, val: &str) -> Result<(), Error> { |
| 328 | let val = val.as_bytes(); |
| 329 | |
| 330 | // Write `val` to the page. The handle is `vlr`. |
| 331 | let (vlr, in_blob) = self.var_view.alloc_for_slice(val)?; |
| 332 | if in_blob { |
| 333 | self.defer_insert_large_blob(vlr, val.to_vec()); |
| 334 | } |
| 335 | |
| 336 | // Write `vlr` to the fixed part. |
| 337 | self.write_var_len_ref(vlr); |
| 338 | Ok(()) |
| 339 | } |
| 340 | |
| 341 | /// Write `val` BSATN-encoded to var-len section |
| 342 | /// and a `VarLenRef` to the fixed buffer and advance the `curr_offset`. |
no test coverage detected