pub struct ConfigurationSchema {
pub name: String,
pub version: String,
pub description: Option<String>,
pub sections: Vec<ConfigSection>,
}
Expand description
Configuration schema definition
Fields§
§name: String
§version: String
§description: Option<String>
§sections: Vec<ConfigSection>
Implementations§
Source§impl ConfigurationSchema
impl ConfigurationSchema
Sourcepub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self
Create a new configuration schema
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set schema description
Sourcepub fn add_section(self, section: ConfigSection) -> Self
pub fn add_section(self, section: ConfigSection) -> Self
Add a configuration section
Sourcepub fn get_section(&self, name: &str) -> Option<&ConfigSection>
pub fn get_section(&self, name: &str) -> Option<&ConfigSection>
Get section by name
Sourcepub fn all_fields(&self) -> Vec<&ConfigField>
pub fn all_fields(&self) -> Vec<&ConfigField>
Get all fields from all sections
Sourcepub fn validate(
&self,
config: &HashMap<String, Value>,
) -> Result<(), ConfigError>
pub fn validate( &self, config: &HashMap<String, Value>, ) -> Result<(), ConfigError>
Validate configuration against this schema
Sourcepub fn to_openapi_schema(&self) -> Value
pub fn to_openapi_schema(&self) -> Value
Generate OpenAPI schema
Trait Implementations§
Source§impl Clone for ConfigurationSchema
impl Clone for ConfigurationSchema
Source§fn clone(&self) -> ConfigurationSchema
fn clone(&self) -> ConfigurationSchema
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 ConfigurationSchema
impl Debug for ConfigurationSchema
Source§impl<'de> Deserialize<'de> for ConfigurationSchema
impl<'de> Deserialize<'de> for ConfigurationSchema
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
Auto Trait Implementations§
impl Freeze for ConfigurationSchema
impl RefUnwindSafe for ConfigurationSchema
impl Send for ConfigurationSchema
impl Sync for ConfigurationSchema
impl Unpin for ConfigurationSchema
impl UnwindSafe for ConfigurationSchema
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