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

Function CreateNamedPipe

crates/vm/src/stdlib/_winapi.rs:842–865  ·  view source on GitHub ↗
(args: CreateNamedPipeArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

840 /// CreateNamedPipe - Create a named pipe
841 #[pyfunction]
842 fn CreateNamedPipe(args: CreateNamedPipeArgs, vm: &VirtualMachine) -> PyResult<WinHandle> {
843 use windows_sys::Win32::System::Pipes::CreateNamedPipeW;
844
845 let name_wide = args.name.as_wtf8().to_wide_with_nul();
846
847 let handle = unsafe {
848 CreateNamedPipeW(
849 name_wide.as_ptr(),
850 args.open_mode,
851 args.pipe_mode,
852 args.max_instances,
853 args.out_buffer_size,
854 args.in_buffer_size,
855 args.default_timeout,
856 null(), // security_attributes - NULL for now
857 )
858 };
859
860 if handle == windows_sys::Win32::Foundation::INVALID_HANDLE_VALUE {
861 return Err(vm.new_last_os_error());
862 }
863
864 Ok(WinHandle(handle))
865 }
866
867 // ==================== Overlapped class ====================
868 // Used for asynchronous I/O operations (ConnectNamedPipe, ReadFile, WriteFile)

Callers

nothing calls this directly

Calls 6

WinHandleClass · 0.85
to_wide_with_nulMethod · 0.80
new_last_os_errorMethod · 0.80
ErrClass · 0.50
as_wtf8Method · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected