runtime/threadable.rs
1use crate::installer::Installer;
2
3/// An interface for a entity that has threads managed by the `Runtime`.
4pub trait Threadable: Send {
5 /// Method that installs the threads that the `Threadable` is responsible for.
6 fn install(&self, installer: &Installer);
7
8 /// Called when threads are requested to pause.
9 ///
10 /// # Errors
11 /// Returns an error is that thread cannot be paused for any reason.
12 #[inline]
13 fn pause(&self) {}
14
15 /// Called when threads are requested to resume.
16 ///
17 /// # Errors
18 /// Returns an error is that thread cannot be resumed for any reason.
19 #[inline]
20 fn resume(&self) {}
21
22 /// Called when threads are requested to finish.
23 ///
24 /// # Errors
25 /// Returns an error is that thread cannot be ended for any reason.
26 #[inline]
27 fn end(&self) {}
28}