(x: HRESULT)
| 638 | } |
| 639 | |
| 640 | fn wrap_hresult(x: HRESULT) -> io::Result<()> { |
| 641 | use std::io::ErrorKind::*; |
| 642 | Err((match x { |
| 643 | S_OK => return Ok(()), |
| 644 | DXGI_ERROR_ACCESS_LOST => ConnectionReset, |
| 645 | DXGI_ERROR_WAIT_TIMEOUT => TimedOut, |
| 646 | DXGI_ERROR_INVALID_CALL => InvalidData, |
| 647 | E_ACCESSDENIED => PermissionDenied, |
| 648 | DXGI_ERROR_UNSUPPORTED => ConnectionRefused, |
| 649 | DXGI_ERROR_NOT_CURRENTLY_AVAILABLE => Interrupted, |
| 650 | DXGI_ERROR_SESSION_DISCONNECTED => ConnectionAborted, |
| 651 | E_INVALIDARG => InvalidInput, |
| 652 | _ => { |
| 653 | // 0x8000ffff https://www.auslogics.com/en/articles/windows-10-update-error-0x8000ffff-fixed/ |
| 654 | return Err(io::Error::new(Other, format!("Error code: {:#X}", x))); |
| 655 | } |
| 656 | }) |
| 657 | .into()) |
| 658 | } |
no outgoing calls
no test coverage detected