diff --git a/satrs/src/request.rs b/satrs/src/request.rs index b0aada7..d84349f 100644 --- a/satrs/src/request.rs +++ b/satrs/src/request.rs @@ -1,8 +1,6 @@ use core::{fmt, marker::PhantomData}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; -#[cfg(feature = "std")] -use std::error::Error; #[cfg(feature = "alloc")] #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))] @@ -26,39 +24,6 @@ pub type RequestId = u32; /// CCSDS APID type definition. Please note that the APID is a 14 bit value. pub type Apid = u16; -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum TargetIdCreationError { - ByteConversion(ByteConversionError), - NotEnoughAppData(usize), -} - -impl From for TargetIdCreationError { - fn from(e: ByteConversionError) -> Self { - Self::ByteConversion(e) - } -} - -impl fmt::Display for TargetIdCreationError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::ByteConversion(e) => write!(f, "target ID creation: {}", e), - Self::NotEnoughAppData(len) => { - write!(f, "not enough app data to generate target ID: {}", len) - } - } - } -} - -#[cfg(feature = "std")] -impl Error for TargetIdCreationError { - fn source(&self) -> Option<&(dyn Error + 'static)> { - if let Self::ByteConversion(e) = self { - return Some(e); - } - None - } -} - #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub struct TargetAndApidId { pub apid: Apid, @@ -88,13 +53,12 @@ impl TargetAndApidId { pub fn from_pus_tc( tc: &(impl CcsdsPacket + PusPacket + IsPusTelecommand), - ) -> Result { + ) -> Result { if tc.user_data().len() < 4 { return Err(ByteConversionError::FromSliceTooSmall { found: tc.user_data().len(), expected: 8, - } - .into()); + }); } Ok(Self { apid: tc.apid(), @@ -417,3 +381,6 @@ pub mod std_mod { pub type MessageReceiverWithIdMpsc = MessageReceiverWithId>; } + +#[cfg(test)] +mod tests {} diff --git a/satrs/tests/mode_tree.rs b/satrs/tests/mode_tree.rs index c9b111e..2bc5544 100644 --- a/satrs/tests/mode_tree.rs +++ b/satrs/tests/mode_tree.rs @@ -3,7 +3,7 @@ use std::{println, sync::mpsc}; use satrs::mode::{ ModeError, ModeProvider, ModeReplyReceiver, ModeReplySender, ModeRequestHandler, - ModeRequestHandlerMpscBounded, ModeRequestReceiver, ModeRequestSender, + ModeRequestHandlerMpscBounded, ModeRequestReceiver, ModeRequestorAndHandlerMpscBounded, ModeRequestorBoundedMpsc, }; use satrs::request::RequestId;