pub struct PolicySchema {
pub params: Vec<ParameterSpec>,
}Available on crate feature
std only.Expand description
Set of uniquely named policy parameters with bounds and initial values.
Validation rejects duplicate names, non-finite values, invalid bounds, and non-positive
maximum step sizes. initial_values extracts a map of names to
starting values.
§Examples
use omega_cognitive_kernel::config::{ParameterSpec, PatchDirection, PolicySchema};
let schema = PolicySchema {
params: vec![ParameterSpec {
name: "temperature".into(),
min: 0.0,
max: 1.0,
initial: 0.25,
max_step: 0.1,
direction: PatchDirection::DecreaseOnError,
}],
};
assert!(schema.validate().is_ok());
assert_eq!(schema.initial_values()["temperature"], 0.25);Fields§
§params: Vec<ParameterSpec>Parameter specifications included in this policy schema.
Implementations§
Trait Implementations§
Source§impl Clone for PolicySchema
impl Clone for PolicySchema
Source§impl Debug for PolicySchema
impl Debug for PolicySchema
Source§impl Default for PolicySchema
impl Default for PolicySchema
Source§impl<'de> Deserialize<'de> for PolicySchema
impl<'de> Deserialize<'de> for PolicySchema
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 PolicySchema
impl PartialEq for PolicySchema
Source§impl Serialize for PolicySchema
impl Serialize for PolicySchema
impl StructuralPartialEq for PolicySchema
Auto Trait Implementations§
impl Forget for PolicySchema
impl Freeze for PolicySchema
impl Move for PolicySchema
impl RefUnwindSafe for PolicySchema
impl Send for PolicySchemawhere
RawVecInner: Send,
impl Sync for PolicySchemawhere
RawVecInner: Sync,
impl Unpin for PolicySchema
impl UnsafeUnpin for PolicySchema
impl UnwindSafe for PolicySchemawhere
RawVecInner: 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