pub enum ObjectiveError {
Pruned,
Failed(Box<dyn Error + Send + Sync>),
}Expand description
Signalled by a user objective to describe how a trial ended.
Returning Ok(value) completes the trial; returning one of these marks it
Pruned or Failed without aborting the whole study. A blanket From
makes ? on any standard error turn into ObjectiveError::Failed, while
ObjectiveError::pruned is used to bail out after should_prune().
Variants§
Pruned
The trial was stopped early by a pruner. Marked crate::TrialState::Pruned.
Failed(Box<dyn Error + Send + Sync>)
The objective failed. Marked crate::TrialState::Failed; the study continues.
Implementations§
Source§impl ObjectiveError
impl ObjectiveError
Sourcepub fn pruned() -> ObjectiveError
pub fn pruned() -> ObjectiveError
Convenience constructor for the pruned case:
if ctx.should_prune() { return Err(ObjectiveError::pruned()); }.
Trait Implementations§
Source§impl Debug for ObjectiveError
impl Debug for ObjectiveError
Source§impl Display for ObjectiveError
impl Display for ObjectiveError
Auto Trait Implementations§
impl !RefUnwindSafe for ObjectiveError
impl !UnwindSafe for ObjectiveError
impl Freeze for ObjectiveError
impl Send for ObjectiveError
impl Sync for ObjectiveError
impl Unpin for ObjectiveError
impl UnsafeUnpin for ObjectiveError
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