Robin Mueller
ba03150178
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good
Introduced high-level abstractions for targetable requests in general. - PUS Service 3 (HK) abstraction for targetable HK requests - PUS Service 8 (Action) abstraction for targetable action requests
46 lines
1.2 KiB
Rust
46 lines
1.2 KiB
Rust
/// Generic error type for sending something via a message queue.
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub enum GenericSendError {
|
|
RxDisconnected,
|
|
QueueFull(Option<u32>),
|
|
}
|
|
|
|
impl Display for GenericSendError {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
|
match self {
|
|
GenericSendError::RxDisconnected => {
|
|
write!(f, "rx side has disconnected")
|
|
}
|
|
GenericSendError::QueueFull(max_cap) => {
|
|
write!(f, "queue with max capacity of {max_cap:?} is full")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "std")]
|
|
impl Error for GenericSendError {}
|
|
|
|
/// Generic error type for sending something via a message queue.
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub enum GenericRecvError {
|
|
Empty,
|
|
TxDisconnected,
|
|
}
|
|
|
|
impl Display for GenericRecvError {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
|
|
match self {
|
|
Self::TxDisconnected => {
|
|
write!(f, "tx side has disconnected")
|
|
}
|
|
Self::Empty => {
|
|
write!(f, "nothing to receive")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "std")]
|
|
impl Error for GenericRecvError {}
|