diff options
Diffstat (limited to 'embassy-executor/src/spawner.rs')
| -rw-r--r-- | embassy-executor/src/spawner.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/embassy-executor/src/spawner.rs b/embassy-executor/src/spawner.rs index ce24589bf..7e76a09c6 100644 --- a/embassy-executor/src/spawner.rs +++ b/embassy-executor/src/spawner.rs | |||
| @@ -51,8 +51,7 @@ impl<S> Drop for SpawnToken<S> { | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | /// Error returned when spawning a task. | 53 | /// Error returned when spawning a task. |
| 54 | #[derive(Copy, Clone, Debug)] | 54 | #[derive(Copy, Clone)] |
| 55 | #[cfg_attr(feature = "defmt", derive(defmt::Format))] | ||
| 56 | pub enum SpawnError { | 55 | pub enum SpawnError { |
| 57 | /// Too many instances of this task are already running. | 56 | /// Too many instances of this task are already running. |
| 58 | /// | 57 | /// |
| @@ -62,10 +61,25 @@ pub enum SpawnError { | |||
| 62 | Busy, | 61 | Busy, |
| 63 | } | 62 | } |
| 64 | 63 | ||
| 64 | impl core::fmt::Debug for SpawnError { | ||
| 65 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
| 66 | core::fmt::Display::fmt(self, f) | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 65 | impl core::fmt::Display for SpawnError { | 70 | impl core::fmt::Display for SpawnError { |
| 66 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | 71 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
| 67 | match self { | 72 | match self { |
| 68 | SpawnError::Busy => write!(f, "Busy"), | 73 | SpawnError::Busy => write!(f, "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."), |
| 74 | } | ||
| 75 | } | ||
| 76 | } | ||
| 77 | |||
| 78 | #[cfg(feature = "defmt")] | ||
| 79 | impl defmt::Format for SpawnError { | ||
| 80 | fn format(&self, f: defmt::Formatter) { | ||
| 81 | match self { | ||
| 82 | SpawnError::Busy => defmt::write!(f, "Busy - Too many instances of this task are already running. Check the `pool_size` attribute of the task."), | ||
| 69 | } | 83 | } |
| 70 | } | 84 | } |
| 71 | } | 85 | } |
