(&self)
| 214 | /// Return the raw byte buffer as a `&CStr`. |
| 215 | #[inline] |
| 216 | pub fn as_c_str(&self) -> &CStr { |
| 217 | let bytes_with_nul = self.as_bytes_with_nul(); |
| 218 | debug_assert!(CStr::from_bytes_with_nul(bytes_with_nul).is_ok()); |
| 219 | |
| 220 | // SAFETY: `self.buf` holds a single decimal ASCII representation and |
| 221 | // at least one extra NUL byte. |
| 222 | unsafe { CStr::from_bytes_with_nul_unchecked(bytes_with_nul) } |
| 223 | } |
| 224 | |
| 225 | /// Return the raw byte buffer including the NUL byte. |
| 226 | #[inline] |
no test coverage detected