Skip to main content

palladium_runtime/multi_core/
errors.rs

1/// Error returned when [`MultiCoreEngine::start`] fails.
2#[derive(Debug)]
3pub enum EngineError {
4    /// The OS refused to spawn a core thread.
5    ThreadSpawnFailed(std::io::Error),
6}
7
8impl std::fmt::Display for EngineError {
9    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10        match self {
11            Self::ThreadSpawnFailed(e) => write!(f, "failed to spawn engine thread: {e}"),
12        }
13    }
14}
15
16impl std::error::Error for EngineError {}
17
18/// Error returned when [`MultiCoreHandle::shutdown`] fails.
19#[derive(Debug)]
20pub enum ShutdownError {
21    /// One or more core threads panicked during shutdown.
22    ThreadPanic,
23}
24
25impl std::fmt::Display for ShutdownError {
26    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27        match self {
28            Self::ThreadPanic => {
29                write!(f, "one or more engine threads panicked during shutdown")
30            }
31        }
32    }
33}
34
35impl std::error::Error for ShutdownError {}