Skip to main content

rill_io/
error.rs

1//! Типы ошибок для rill-io
2
3use thiserror::Error;
4
5/// Ошибки ввода-вывода
6#[derive(Error, Debug)]
7pub enum IoError {
8    /// Backend-specific error
9    #[error("Backend error: {0}")]
10    Backend(String),
11
12    /// Device not found
13    #[error("Device not found: {0}")]
14    DeviceNotFound(String),
15
16    /// Configuration error
17    #[error("Configuration error: {0}")]
18    Config(String),
19
20    /// Stream error
21    #[error("Stream error: {0}")]
22    Stream(String),
23
24    /// Initialization error
25    #[error("Initialization error: {0}")]
26    Init(String),
27
28    /// Unsupported feature
29    #[error("Unsupported feature: {0}")]
30    Unsupported(String),
31
32    /// Operation timed out
33    #[error("Timeout")]
34    Timeout,
35
36    /// Wrapped `std::io::Error`
37    #[error("IO error: {0}")]
38    Io(#[from] std::io::Error),
39
40    /// Channel communication error
41    #[error("Channel error")]
42    Channel,
43}
44
45/// Результат операций ввода-вывода
46pub type IoResult<T> = Result<T, IoError>;