Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/cros_async/src/sys/windows/error.rs
5394 views
1
// Copyright 2024 The ChromiumOS Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
use std::io;
6
7
#[remain::sorted]
8
#[derive(Debug, thiserror::Error)]
9
pub enum AsyncErrorSys {
10
#[error("An error with a handle executor: {0}")]
11
HandleExecutor(#[from] super::handle_executor::Error),
12
#[error("An error with a handle source: {0}")]
13
HandleSource(#[from] super::handle_source::Error),
14
#[error("An error with a handle source: {0}")]
15
OverlappedSource(#[from] super::overlapped_source::Error),
16
#[cfg(feature = "tokio")]
17
#[error("Tokio source error: {0}")]
18
Tokio(#[from] super::tokio_source::Error),
19
}
20
21
impl From<AsyncErrorSys> for io::Error {
22
fn from(err: AsyncErrorSys) -> Self {
23
match err {
24
AsyncErrorSys::HandleExecutor(e) => e.into(),
25
AsyncErrorSys::HandleSource(e) => e.into(),
26
AsyncErrorSys::OverlappedSource(e) => e.into(),
27
#[cfg(feature = "tokio")]
28
AsyncErrorSys::Tokio(e) => e.into(),
29
}
30
}
31
}
32
33