Skip to content

Commit

Permalink
feat(bolero-generator): add trace utility (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Jul 2, 2024
1 parent 8ee8a20 commit 429a416
Show file tree
Hide file tree
Showing 3 changed files with 529 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/bolero-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ rand_core = { version = "0.6", default-features = false }

[dev-dependencies]
rand = "0.8"

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
'cfg(kani)',
'cfg(fuzzing)',
'cfg(fuzzing_afl)',
'cfg(fuzzing_libfuzzer)',
'cfg(fuzzing_honggfuzz)',
'cfg(fuzzing_random)'
]
9 changes: 9 additions & 0 deletions lib/bolero-generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub mod one_of;
pub mod range;
pub mod result;
pub mod time;
#[cfg(feature = "std")]
pub mod trace;
pub mod tuple;

#[cfg(feature = "arbitrary")]
Expand Down Expand Up @@ -143,6 +145,13 @@ pub trait ValueGenerator: Sized {
filter_map,
}
}

/// Traces generated values to `stderr`
#[cfg(feature = "std")]
#[inline]
fn trace(self) -> trace::Trace<Self> {
trace::Trace::new(self)
}
}

impl<'a, T: ValueGenerator> ValueGenerator for &'a T {
Expand Down
Loading

0 comments on commit 429a416

Please sign in to comment.