pub struct QualityLoop<T, C, R>{ /* private fields */ }Expand description
Drive a critic + refiner pair to convergence.
Implementations§
Source§impl<T, C, R> QualityLoop<T, C, R>
impl<T, C, R> QualityLoop<T, C, R>
Sourcepub fn new(critic: C, refiner: R) -> Self
pub fn new(critic: C, refiner: R) -> Self
Build a loop with the default iteration budget
(DEFAULT_MAX_ITERATIONS).
Sourcepub fn with_max_iterations(self, n: u8) -> Self
pub fn with_max_iterations(self, n: u8) -> Self
Override the maximum iteration count. Setting 0 is rejected
at run-time with SpecError::Config.
Sourcepub async fn run(&self, t: T) -> Result<(T, QualityMetadata), SpecError>
pub async fn run(&self, t: T) -> Result<(T, QualityMetadata), SpecError>
Run the loop. Returns the final T and run metadata.
Important: the returned T may not satisfy the critic —
inspect QualityMetadata::passed before relying on it.
Auto Trait Implementations§
impl<T, C, R> Freeze for QualityLoop<T, C, R>
impl<T, C, R> RefUnwindSafe for QualityLoop<T, C, R>where
C: RefUnwindSafe,
R: RefUnwindSafe,
impl<T, C, R> Send for QualityLoop<T, C, R>
impl<T, C, R> Sync for QualityLoop<T, C, R>
impl<T, C, R> Unpin for QualityLoop<T, C, R>
impl<T, C, R> UnsafeUnpin for QualityLoop<T, C, R>where
C: UnsafeUnpin,
R: UnsafeUnpin,
impl<T, C, R> UnwindSafe for QualityLoop<T, C, R>where
C: UnwindSafe,
R: UnwindSafe,
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