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

Function path_from_cstr

crates/stdlib/src/openssl.rs:436–447  ·  view source on GitHub ↗
(c: &CStr)

Source from the content-addressed store, hash-verified

434 // Lazily compute and cache cert file/dir paths
435 static CERT_PATHS: LazyLock<(PathBuf, PathBuf)> = LazyLock::new(|| {
436 fn path_from_cstr(c: &CStr) -> PathBuf {
437 #[cfg(unix)]
438 {
439 use std::os::unix::ffi::OsStrExt;
440 std::ffi::OsStr::from_bytes(c.to_bytes()).into()
441 }
442 #[cfg(windows)]
443 {
444 // Use lossy conversion for potential non-UTF8
445 PathBuf::from(c.to_string_lossy().as_ref())
446 }
447 }
448
449 let probe = probe();
450 let cert_file = probe

Callers 1

openssl.rsFile · 0.85

Calls 3

to_bytesMethod · 0.80
as_refMethod · 0.45
to_string_lossyMethod · 0.45

Tested by

no test coverage detected