pub fn as_c_str(&self) -> Result<&CStr> {
        let bytes_with_null =
            unsafe { slice::from_raw_parts(self.val.as_ptr().cast(), self.len() + 1) };
        CStr::from_bytes_with_nul(bytes_with_null).map_err(|_| Error::InvalidCString)
    }
Attempts to return a reference to the underlying bytes inside the Zend
string as a [`CStr`].

# Errors

Returns an [`Error::InvalidCString`] variant if the string contains null
bytes.
src/types/string.rs