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

Method as_os_str

crates/vm/src/function/fspath.rs:84–90  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

82 }
83
84 pub fn as_os_str(&self, vm: &VirtualMachine) -> PyResult<Cow<'_, OsStr>> {
85 // TODO: FS encodings
86 match self {
87 Self::Str(s) => vm.fsencode(s),
88 Self::Bytes(b) => Self::bytes_as_os_str(b.as_bytes(), vm).map(Cow::Borrowed),
89 }
90 }
91
92 pub fn as_bytes(&self) -> &[u8] {
93 // TODO: FS encodings

Callers 12

from_fspathMethod · 0.80
to_wide_cstringMethod · 0.80
_test_file_type_by_nameFunction · 0.80
load_library_unixFunction · 0.80
chownFunction · 0.80
statMethod · 0.80
inodeMethod · 0.80
nextMethod · 0.80
stat_innerFunction · 0.80
chdirFunction · 0.80
linkFunction · 0.80

Calls 4

fsencodeMethod · 0.80
bytes_as_os_strFunction · 0.50
mapMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected