Bind SQLite to Rust

This commit is contained in:
topjohnwu
2025-01-03 11:38:15 -08:00
committed by John Wu
parent 8e1a44e7eb
commit 24650eefe4
17 changed files with 765 additions and 521 deletions

View File

@@ -340,6 +340,11 @@ impl Utf8CStr {
Self::from_cstr(unsafe { CStr::from_ptr(ptr) })
}
pub unsafe fn from_ptr_unchecked<'a>(ptr: *const c_char) -> &'a Utf8CStr {
let cstr = CStr::from_ptr(ptr);
Self::from_bytes_unchecked(cstr.to_bytes_with_nul())
}
#[inline(always)]
pub fn as_bytes_with_nul(&self) -> &[u8] {
&self.0