#[non_exhaustive]pub struct MetricSpec {
pub metric_id: String,
pub goal: GoalType,
pub safety_config: Option<SafetyMetricConfig>,
/* private fields */
}Expand description
Represents a metric to optimize.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.metric_id: StringRequired. The ID of the metric. Must not contain whitespaces and must be unique amongst all MetricSpecs.
goal: GoalTypeRequired. The optimization goal of the metric.
safety_config: Option<SafetyMetricConfig>Used for safe search. In the case, the metric will be a safety metric. You must provide a separate metric for objective metric.
Implementations§
Source§impl MetricSpec
impl MetricSpec
pub fn new() -> Self
Sourcepub fn set_metric_id<T: Into<String>>(self, v: T) -> Self
pub fn set_metric_id<T: Into<String>>(self, v: T) -> Self
Sets the value of metric_id.
Sourcepub fn set_safety_config<T: Into<Option<SafetyMetricConfig>>>(
self,
v: T,
) -> Self
pub fn set_safety_config<T: Into<Option<SafetyMetricConfig>>>( self, v: T, ) -> Self
Sets the value of safety_config.
Trait Implementations§
Source§impl Clone for MetricSpec
impl Clone for MetricSpec
Source§fn clone(&self) -> MetricSpec
fn clone(&self) -> MetricSpec
Returns a copy of the value. Read more
1.0.0 · 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 MetricSpec
impl Debug for MetricSpec
Source§impl Default for MetricSpec
impl Default for MetricSpec
Source§fn default() -> MetricSpec
fn default() -> MetricSpec
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MetricSpecwhere
MetricSpec: Default,
impl<'de> Deserialize<'de> for MetricSpecwhere
MetricSpec: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for MetricSpec
impl PartialEq for MetricSpec
Source§impl Serialize for MetricSpec
impl Serialize for MetricSpec
impl StructuralPartialEq for MetricSpec
Auto Trait Implementations§
impl Freeze for MetricSpec
impl RefUnwindSafe for MetricSpec
impl Send for MetricSpec
impl Sync for MetricSpec
impl Unpin for MetricSpec
impl UnwindSafe for MetricSpec
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