pub struct RegisteredObjective<T: Send + Sync> {
pub name: String,
pub description: Option<String>,
/* private fields */
}Expand description
A type-erased objective wrapper.
Fields§
§name: String§description: Option<String>Implementations§
Source§impl<T: Send + Sync> RegisteredObjective<T>
impl<T: Send + Sync> RegisteredObjective<T>
pub fn new(name: impl Into<String>, objective: Box<dyn Objective<T>>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Sourcepub fn score(&self, candidate: &T, context: &ObjectiveContext) -> f64
pub fn score(&self, candidate: &T, context: &ObjectiveContext) -> f64
Raw score (no precision weighting). Use select() for ranked selection
that applies score * precision per ADR-059.
pub fn select<'a>( &self, candidates: &'a [T], context: &ObjectiveContext, ) -> ObjectiveResult<Selection<&'a T>>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RegisteredObjective<T>
impl<T> !RefUnwindSafe for RegisteredObjective<T>
impl<T> Send for RegisteredObjective<T>
impl<T> Sync for RegisteredObjective<T>
impl<T> Unpin for RegisteredObjective<T>
impl<T> UnsafeUnpin for RegisteredObjective<T>
impl<T> !UnwindSafe for RegisteredObjective<T>
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