Implement FeedbackFactory for {Const,Not}Feedback (#2478)

* libafl: Impl FeedbackFactory for NotFeedback

* libafl: Impl FeedbackFactory for ConstFeedback
This commit is contained in:
Niklas Gögge 2024-08-09 11:24:46 +01:00 committed by GitHub
parent 9b32f85124
commit 799c634fef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -818,6 +818,16 @@ where
} }
} }
impl<A, S, T> FeedbackFactory<NotFeedback<A, S>, T> for NotFeedback<A, S>
where
A: Feedback<S> + FeedbackFactory<A, T>,
S: State,
{
fn create_feedback(&self, ctx: &T) -> NotFeedback<A, S> {
NotFeedback::new(self.first.create_feedback(ctx))
}
}
impl<A, S> NotFeedback<A, S> impl<A, S> NotFeedback<A, S>
where where
A: Feedback<S>, A: Feedback<S>,
@ -1279,6 +1289,12 @@ impl From<ConstFeedback> for bool {
} }
} }
impl<T> FeedbackFactory<ConstFeedback, T> for ConstFeedback {
fn create_feedback(&self, _ctx: &T) -> ConstFeedback {
*self
}
}
#[cfg(feature = "track_hit_feedbacks")] #[cfg(feature = "track_hit_feedbacks")]
/// Error if [`Feedback::last_result`] is called before the `Feedback` is actually run. /// Error if [`Feedback::last_result`] is called before the `Feedback` is actually run.
pub(crate) fn premature_last_result_err() -> Error { pub(crate) fn premature_last_result_err() -> Error {