Promote remaining error types to windows-result
#3783
Merged
+12,329
−12,228
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
windows-resultcrate provides the essential source of Windows error handling and propagation and is the home of types likeHRESULTandBOOL, but other types like those representing NT/Win32/RPC error codes have traditionally been left up towindows-bindgenor thewindowscrate to define. Increasingly as projects depend more onwindows-bindgenrather than the monolithicwindowscrate, having these dedicated error types in one place makes life a lot easier and improves interopability while reducing everyone's dependence on thewindowscrate for such fundamental types.So with this update, the following types move out of the
windowscrate and directly into thewindows-resultcrate:NTSTATUSWIN32_ERRORRPC_STATUSThe
windows-resultcrate can now also provide richer conversions since the types are now known. As such,HRESULT'sfrom_win32andfrom_ntfunctions have been replaced with more naturalFromimplementations as well asto_hresultalternatives for when you needconstfunctions.This does not affect raw or sys-style bindings.
This is also related to #3294 but does not yet change the default
Resultspecialization as that is a much bigger change.