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("Poll source error: {0}")] 11 Poll(#[from] super::poll_source::Error), 12 #[cfg(feature = "tokio")] 13 #[error("Tokio source error: {0}")] 14 Tokio(#[from] super::tokio_source::Error), 15 #[error("Uring source error: {0}")] 16 Uring(#[from] super::uring_executor::Error), 17 } 18 19 impl From<AsyncErrorSys> for io::Error { from(err: AsyncErrorSys) -> Self20 fn from(err: AsyncErrorSys) -> Self { 21 match err { 22 AsyncErrorSys::Poll(e) => e.into(), 23 #[cfg(feature = "tokio")] 24 AsyncErrorSys::Tokio(e) => e.into(), 25 AsyncErrorSys::Uring(e) => e.into(), 26 } 27 } 28 } 29