1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use std::io;
use thiserror::Error;
use crate::eventfd::EventFdError;
/// AIO command error
#[derive(Error, Debug)]
pub enum AioCommandError {
/// AIO context was stopped
#[error("AioContext stopped")]
AioStopped,
/// Error from [`io_submit`]
///
/// [`io_submit`]: https://manpages.debian.org/testing/manpages-dev/io_submit.2.en.html
#[error("io_submit error: {0}")]
IoSubmit(#[source] io::Error),
/// Bad result received
#[error("bad result: `{0}`")]
BadResult(#[source] io::Error),
/// Non-zero length returned
#[error("non-zero code returned")]
NonZeroCode,
/// The capacity of AIO context exceeded. Happens if `use_semaphore` set to `false`
/// and the code attempts to send more requests than kernel-threads.
#[error("capacity exceeded")]
CapacityExceeded,
}
/// AIO context creation error
#[derive(Error, Debug)]
pub enum AioContextError {
/// Could not create [`EventFd`]
///
/// [`EventFd`]: struct.EventFd.html
#[error("eventfd error: `{0}`")]
EventFd(#[from] EventFdError),
/// Error from `io_setup`
#[error("io_setup error: `{0}`")]
IoSetup(#[from] io::Error),
}