pub struct ConfigFile {
pub defaults: DefaultsConfig,
pub baseline_server: BaselineServerConfig,
pub benches: Vec<BenchConfigFile>,
}Expand description
Top-level configuration file (perfgate.toml).
§Examples
use perfgate_types::ConfigFile;
let toml_str = r#"
[defaults]
repeat = 5
threshold = 0.20
[[bench]]
name = "my-bench"
command = ["echo", "hello"]
"#;
let config: ConfigFile = toml::from_str(toml_str).unwrap();
assert_eq!(config.benches.len(), 1);
assert_eq!(config.benches[0].name, "my-bench");
assert_eq!(config.defaults.repeat, Some(5));Fields§
§defaults: DefaultsConfig§baseline_server: BaselineServerConfigOptional baseline server configuration for centralized baseline management.
benches: Vec<BenchConfigFile>Implementations§
Source§impl ConfigFile
impl ConfigFile
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate all bench names in this config. Returns an error if any name is invalid.
§Examples
use perfgate_types::ConfigFile;
let good: ConfigFile = toml::from_str(r#"
[[bench]]
name = "valid-bench"
command = ["echo"]
"#).unwrap();
assert!(good.validate().is_ok());
let bad: ConfigFile = toml::from_str(r#"
[[bench]]
name = "INVALID|name"
command = ["echo"]
"#).unwrap();
assert!(bad.validate().is_err());Trait Implementations§
Source§impl Clone for ConfigFile
impl Clone for ConfigFile
Source§fn clone(&self) -> ConfigFile
fn clone(&self) -> ConfigFile
Returns a duplicate 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 ConfigFile
impl Debug for ConfigFile
Source§impl Default for ConfigFile
impl Default for ConfigFile
Source§fn default() -> ConfigFile
fn default() -> ConfigFile
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ConfigFile
impl<'de> Deserialize<'de> for ConfigFile
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 JsonSchema for ConfigFile
impl JsonSchema for ConfigFile
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ConfigFile
impl PartialEq for ConfigFile
Source§impl Serialize for ConfigFile
impl Serialize for ConfigFile
impl StructuralPartialEq for ConfigFile
Auto Trait Implementations§
impl Freeze for ConfigFile
impl RefUnwindSafe for ConfigFile
impl Send for ConfigFile
impl Sync for ConfigFile
impl Unpin for ConfigFile
impl UnsafeUnpin for ConfigFile
impl UnwindSafe for ConfigFile
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