We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6648bc9 commit 6243b68Copy full SHA for 6243b68
libafl/src/mutators/mod.rs
@@ -407,3 +407,22 @@ impl Named for NopMutator {
407
&Cow::Borrowed("NopMutator")
408
}
409
410
+
411
+/// [`Mutator`] that flips a boolean value.
412
+///
413
+/// Mostly useful in combination with [`mapping::MappingMutator`]s.
414
+#[derive(Debug)]
415
+pub struct BoolMutator;
416
417
+impl<S> Mutator<bool, S> for BoolMutator {
418
+ fn mutate(&mut self, _state: &mut S, input: &mut bool) -> Result<MutationResult, Error> {
419
+ *input = !*input;
420
+ Ok(MutationResult::Mutated)
421
+ }
422
+}
423
424
+impl Named for BoolMutator {
425
+ fn name(&self) -> &Cow<'static, str> {
426
+ &Cow::Borrowed("BoolMutator")
427
428
0 commit comments