What is sys::process crate

In process.rs - source
I see that pub struct ExitStatus(imp::ExitStatus);

imp is just :sys::process
use crate::sys::process as imp;
I have been looking for where the source code for sys::process is but I can't find it .
I think it refers to pub struct ExitStatus(c::DWORD); in std\src\sys\windows\process.rs
I am using rust on windows.
What I don't understand is how can crate::sys::process refer to sys\windows\process.rs .
What rust feature allows this. Shouldn't it be something like
use crate::sys::windows::process as imp;

The sys module re-exports the contents of the platform-specific module, here:

1 Like

sys is defined here, which on linux re-exports this process module, involving some extra conditional compilation, but probably commonly ending up with this module for process_inner, where ExitStatus is defined here.

For a faster way to get there, I can recommend the website stdrs.dev where someone is hosting standard library docs (of nightly rust) with internals documented, too. Going to ExitStatus’s page there lets you simply click on the type of the field, and you land at this page, or pehaps, first switch the platform to windows (dropdown on the left in the side-bar) and click the field’s type then to land here, which is indeed the one from std\src\sys\windows\process.rs.

1 Like