I'm calling the ResumeThread
WinAPI function from Rust, using the winapi crate.
The documentation says:
If the function succeeds, the return value is the thread's previous suspend count.
If the function fails, the return value is (DWORD) -1.
How can I effectively check if there was an error?
In C:
if (ResumeThread(hMyThread) == (DWORD) -1) {
// There was an error....
}
In Rust:
unsafe {
if ResumeThread(my_thread) == -1 {
// There was an error....
}
}
the trait `std::ops::Neg` is not implemented for `u32`
I understand the error; but what is the best way to be semantically the same as the C code? Check against std::u32::MAX
?