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

Function socketpair

crates/stdlib/src/socket.rs:3061–3075  ·  view source on GitHub ↗
(
        family: OptionalArg<i32>,
        socket_kind: OptionalArg<i32>,
        proto: OptionalArg<i32>,
    )

Source from the content-addressed store, hash-verified

3059 #[cfg(unix)]
3060 #[pyfunction]
3061 fn socketpair(
3062 family: OptionalArg<i32>,
3063 socket_kind: OptionalArg<i32>,
3064 proto: OptionalArg<i32>,
3065 ) -> Result<(PySocket, PySocket), IoOrPyException> {
3066 let family = family.unwrap_or(libc::AF_UNIX);
3067 let socket_kind = socket_kind.unwrap_or(libc::SOCK_STREAM);
3068 let proto = proto.unwrap_or(0);
3069 let (a, b) = Socket::pair(family.into(), socket_kind.into(), Some(proto.into()))?;
3070 let py_a = PySocket::default();
3071 py_a.init_inner(family, socket_kind, proto, a)?;
3072 let py_b = PySocket::default();
3073 py_b.init_inner(family, socket_kind, proto, b)?;
3074 Ok((py_a, py_b))
3075 }
3076
3077 #[cfg(all(unix, not(target_os = "redox")))]
3078 type IfIndex = c::c_uint;

Callers

nothing calls this directly

Calls 2

init_innerMethod · 0.80
SomeClass · 0.50

Tested by

no test coverage detected