fix compile error
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2024-03-13 12:05:49 +01:00
parent 41db3b86da
commit 300289608e
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -323,6 +323,20 @@ impl ActiveRequestProvider for ActiveRequest {
}
}
/// Generic user hook method.
///
/// This hook method currently serves the following tasks:
///
/// 1. Pass specific information to the reply handlers which can not be kept inside the
/// framework. This includes information like the error codes used for packet verification.
/// 2. It exposes callback methods which can be useful to perform custom user operations like
/// logging.
pub trait ReplyHandlerHook<ActiveRequestType, ReplyType> {
fn handle_unexpected_reply(&mut self, reply: &ReplyType);
fn timeout_callback(&self, active_request: &ActiveRequestType);
fn timeout_error_code(&self) -> ResultU16;
}
#[cfg(feature = "alloc")]
mod alloc_mod {
use hashbrown::HashMap;
@ -464,55 +478,40 @@ mod alloc_mod {
}
}
}
}
/// Generic user hook method.
///
/// This hook method currently serves the following tasks:
///
/// 1. Pass specific information to the reply handlers which can not be kept inside the
/// framework. This includes information like the error codes used for packet verification.
/// 2. It exposes callback methods which can be useful to perform custom user operations like
/// logging.
pub trait ReplyHandlerHook<ActiveRequestType, ReplyType> {
fn handle_unexpected_reply(&mut self, reply: &ReplyType);
fn timeout_callback(&self, active_request: &ActiveRequestType);
fn timeout_error_code(&self) -> ResultU16;
}
/// Generic reply handler structure which can be used to handle replies for a specific PUS service.
///
/// This is done by keeping track of active requests using an internal map structure. An API
/// to register new active requests is exposed as well.
/// The reply handler performs boilerplate tasks like performing the verification handling and
/// timeout handling.
///
/// This object is not useful by itself but serves as a common building block for high-level
/// PUS reply handlers. Concrete PUS handlers should constrain the [ActiveRequestProvider] and
/// the `ReplyType` generics to specific types tailored towards PUS services in addition to
/// providing an API which can process received replies and convert them into verification
/// completions or other operation like user hook calls. The framework also provides some concrete
/// PUS handlers for common PUS services like the mode, action and housekeeping service.
///
/// This object does not automatically update its internal time information used to check for
/// timeouts. The user should call the [Self::update_time] and [Self::update_time_from_now] methods
/// to do this.
pub struct PusServiceReplyHandler<
/// Generic reply handler structure which can be used to handle replies for a specific PUS service.
///
/// This is done by keeping track of active requests using an internal map structure. An API
/// to register new active requests is exposed as well.
/// The reply handler performs boilerplate tasks like performing the verification handling and
/// timeout handling.
///
/// This object is not useful by itself but serves as a common building block for high-level
/// PUS reply handlers. Concrete PUS handlers should constrain the [ActiveRequestProvider] and
/// the `ReplyType` generics to specific types tailored towards PUS services in addition to
/// providing an API which can process received replies and convert them into verification
/// completions or other operation like user hook calls. The framework also provides some concrete
/// PUS handlers for common PUS services like the mode, action and housekeeping service.
///
/// This object does not automatically update its internal time information used to check for
/// timeouts. The user should call the [Self::update_time] and [Self::update_time_from_now] methods
/// to do this.
pub struct PusServiceReplyHandler<
VerificationReporter: VerificationReportingProvider,
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestType>,
UserHook: ReplyHandlerHook<ActiveRequestType, ReplyType>,
ActiveRequestType: ActiveRequestProvider,
ReplyType,
> {
> {
active_request_map: ActiveRequestMap,
verification_reporter: VerificationReporter,
fail_data_buf: alloc::vec::Vec<u8>,
current_time: UnixTimestamp,
pub user_hook: UserHook,
phantom: PhantomData<(ActiveRequestType, ReplyType)>,
}
}
impl<
impl<
VerificationReporter: VerificationReportingProvider,
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestType>,
UserHook: ReplyHandlerHook<ActiveRequestType, ReplyType>,
@ -526,7 +525,7 @@ impl<
ActiveRequestType,
ReplyType,
>
{
{
#[cfg(feature = "std")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
pub fn new_from_now(
@ -626,6 +625,7 @@ impl<
pub fn update_time(&mut self, time: UnixTimestamp) {
self.current_time = time;
}
}
}
#[cfg(feature = "std")]