MCPcopy Index your code
hub / github.com/RustPython/RustPython / str_to_ptr_len

Function str_to_ptr_len

crates/stdlib/src/_sqlite3.rs:3448–3454  ·  view source on GitHub ↗
(s: &PyUtf8Str, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

3446 }
3447
3448 fn str_to_ptr_len(s: &PyUtf8Str, vm: &VirtualMachine) -> PyResult<(*const libc::c_char, i32)> {
3449 let s_str = s.as_str();
3450 let len = c_int::try_from(s_str.len())
3451 .map_err(|_| vm.new_overflow_error("TEXT longer than INT_MAX bytes"))?;
3452 let ptr = s_str.as_ptr().cast();
3453 Ok((ptr, len))
3454 }
3455
3456 fn buffer_to_ptr_len(buffer: &PyBuffer, vm: &VirtualMachine) -> PyResult<(*const c_void, i32)> {
3457 let bytes = buffer

Callers 2

bind_parameterMethod · 0.85
result_from_objectMethod · 0.85

Calls 4

as_strMethod · 0.45
lenMethod · 0.45
castMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected