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

Function ptr_to_str

crates/stdlib/src/_sqlite3.rs:3411–3417  ·  view source on GitHub ↗
(p: *const libc::c_char, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

3409 }
3410
3411 fn ptr_to_str<'a>(p: *const libc::c_char, vm: &VirtualMachine) -> PyResult<&'a str> {
3412 if p.is_null() {
3413 return Err(vm.new_memory_error("string pointer is null"));
3414 }
3415 unsafe { CStr::from_ptr(p).to_str() }
3416 .map_err(|_| vm.new_value_error("Invalid UIF-8 codepoint"))
3417 }
3418
3419 fn ptr_to_string(
3420 p: *const u8,

Callers 7

sqlite_versionFunction · 0.85
authorizer_callbackMethod · 0.85
trace_callbackMethod · 0.85
build_row_cast_mapMethod · 0.85
nextMethod · 0.85
bind_parameters_nameMethod · 0.85
columns_nameMethod · 0.85

Calls 2

to_strMethod · 0.80
ErrClass · 0.50

Tested by

no test coverage detected