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

Function inet_aton

crates/stdlib/src/socket.rs:2650–2658  ·  view source on GitHub ↗
(ip_string: PyUtf8StrRef, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

2648
2649 #[pyfunction]
2650 fn inet_aton(ip_string: PyUtf8StrRef, vm: &VirtualMachine) -> PyResult<Vec<u8>> {
2651 ip_string
2652 .as_str()
2653 .parse::<Ipv4Addr>()
2654 .map(|ip_addr| Vec::<u8>::from(ip_addr.octets()))
2655 .map_err(|_| {
2656 vm.new_os_error("illegal IP address string passed to inet_aton".to_owned())
2657 })
2658 }
2659
2660 #[pyfunction]
2661 fn inet_ntoa(packed_ip: ArgBytesLike, vm: &VirtualMachine) -> PyResult<PyStrRef> {

Callers

nothing calls this directly

Calls 4

new_os_errorMethod · 0.80
mapMethod · 0.45
as_strMethod · 0.45
to_ownedMethod · 0.45

Tested by

no test coverage detected