pub struct ConfigField {
pub name: String,
pub field_type: String,
pub required: bool,
pub default_value: Option<String>,
pub description: Option<String>,
pub validation_rules: Vec<String>,
}
Expand description
Configuration field definition
Fields§
§name: String
§field_type: String
§required: bool
§default_value: Option<String>
§description: Option<String>
§validation_rules: Vec<String>
Implementations§
Source§impl ConfigField
impl ConfigField
Sourcepub fn new(name: impl Into<String>, field_type: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, field_type: impl Into<String>) -> Self
Create a new configuration field
Sourcepub fn with_default(self, default: impl Into<String>) -> Self
pub fn with_default(self, default: impl Into<String>) -> Self
Set default value
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set description
Sourcepub fn add_validation(self, rule: impl Into<String>) -> Self
pub fn add_validation(self, rule: impl Into<String>) -> Self
Add validation rule
Source§impl ConfigField
impl ConfigField
Sourcepub fn to_openapi_property(&self) -> Value
pub fn to_openapi_property(&self) -> Value
Convert field to OpenAPI property definition
Trait Implementations§
Source§impl Clone for ConfigField
impl Clone for ConfigField
Source§fn clone(&self) -> ConfigField
fn clone(&self) -> ConfigField
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 ConfigField
impl Debug for ConfigField
Source§impl<'de> Deserialize<'de> for ConfigField
impl<'de> Deserialize<'de> for ConfigField
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 ConfigField
impl RefUnwindSafe for ConfigField
impl Send for ConfigField
impl Sync for ConfigField
impl Unpin for ConfigField
impl UnwindSafe for ConfigField
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