pub struct ConfigSchema {
pub name: String,
pub fields: Vec<ConfigField>,
}Expand description
Configuration schema for validation and generation
Fields§
§name: String§fields: Vec<ConfigField>Implementations§
Source§impl ConfigSchema
impl ConfigSchema
Sourcepub fn add_field(self, field: ConfigField) -> Self
pub fn add_field(self, field: ConfigField) -> Self
Add a field to the schema
Sourcepub fn get_field(&self, name: &str) -> Option<&ConfigField>
pub fn get_field(&self, name: &str) -> Option<&ConfigField>
Get field by name
Sourcepub fn required_fields(&self) -> Vec<&ConfigField>
pub fn required_fields(&self) -> Vec<&ConfigField>
Get all required fields
Sourcepub fn validate_config(
&self,
config: &HashMap<String, String>,
) -> Result<(), ConfigError>
pub fn validate_config( &self, config: &HashMap<String, String>, ) -> Result<(), ConfigError>
Validate a configuration map against this schema
Trait Implementations§
Source§impl Clone for ConfigSchema
impl Clone for ConfigSchema
Source§fn clone(&self) -> ConfigSchema
fn clone(&self) -> ConfigSchema
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 moreAuto Trait Implementations§
impl Freeze for ConfigSchema
impl RefUnwindSafe for ConfigSchema
impl Send for ConfigSchema
impl Sync for ConfigSchema
impl Unpin for ConfigSchema
impl UnwindSafe for ConfigSchema
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