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

Function gethostname

crates/stdlib/src/socket.rs:2636–2641  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

2634
2635 #[pyfunction]
2636 fn gethostname(vm: &VirtualMachine) -> PyResult<PyStrRef> {
2637 gethostname::gethostname()
2638 .into_string()
2639 .map(|hostname| vm.ctx.new_str(hostname))
2640 .map_err(|err| vm.new_os_error(err.into_string().unwrap()))
2641 }
2642
2643 #[cfg(all(unix, not(target_os = "redox")))]
2644 #[pyfunction]

Callers

nothing calls this directly

Calls 5

into_stringMethod · 0.80
new_os_errorMethod · 0.80
mapMethod · 0.45
new_strMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected