pub struct DdminOptions { /* private fields */ }Expand description
Execution options for DDMin.
Implementations§
Source§impl DdminOptions
impl DdminOptions
Sourcepub const fn new(
initial_granularity: NonZeroUsize,
max_oracle_calls: Option<usize>,
) -> Self
pub const fn new( initial_granularity: NonZeroUsize, max_oracle_calls: Option<usize>, ) -> Self
Create execution options.
initial_granularity controls the first split count. Values below two are accepted
and normalized by the algorithm. max_oracle_calls stops the run after that many
oracle evaluations.
Examples found in repository?
examples/budgeted.rs (line 8)
7fn main() {
8 let options = DdminOptions::new(NonZeroUsize::MIN, Some(1));
9 let input = DdminInput::new(vec![1_u8, 2, 3, 4], options);
10 let mut oracle = |remaining: &[u8]| {
11 if remaining.contains(&2) {
12 OracleOutcome::Interesting
13 } else {
14 OracleOutcome::NotInteresting
15 }
16 };
17
18 let output = ddmin(input, &mut oracle);
19 assert_eq!(
20 output.guarantee(),
21 DdminGuarantee::Incomplete(DdminStopReason::MaxOracleCallsReached),
22 "DDMin should report an incomplete guarantee when the oracle-call budget is exhausted"
23 );
24 assert_eq!(output.stats().oracle_calls(), 1, "DDMin should stop at the configured budget");
25}Sourcepub const fn initial_granularity(self) -> NonZeroUsize
pub const fn initial_granularity(self) -> NonZeroUsize
Requested initial split count.
Sourcepub const fn max_oracle_calls(self) -> Option<usize>
pub const fn max_oracle_calls(self) -> Option<usize>
Optional maximum number of oracle evaluations for one run.
Trait Implementations§
Source§impl Clone for DdminOptions
impl Clone for DdminOptions
Source§fn clone(&self) -> DdminOptions
fn clone(&self) -> DdminOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DdminOptions
impl Debug for DdminOptions
Source§impl Default for DdminOptions
impl Default for DdminOptions
Source§impl PartialEq for DdminOptions
impl PartialEq for DdminOptions
Source§fn eq(&self, other: &DdminOptions) -> bool
fn eq(&self, other: &DdminOptions) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for DdminOptions
impl Eq for DdminOptions
impl StructuralPartialEq for DdminOptions
Auto Trait Implementations§
impl Freeze for DdminOptions
impl RefUnwindSafe for DdminOptions
impl Send for DdminOptions
impl Sync for DdminOptions
impl Unpin for DdminOptions
impl UnsafeUnpin for DdminOptions
impl UnwindSafe for DdminOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more