pub struct ConfigFieldSchema {
pub name: String,
pub field_type: ConfigFieldType,
pub required: bool,
pub min: Option<f64>,
pub max: Option<f64>,
pub min_length: Option<usize>,
pub max_length: Option<usize>,
pub allowed_values: Option<Vec<String>>,
}Expand description
Configuration field schema definition
Fields§
§name: StringField name
field_type: ConfigFieldTypeField type
required: boolWhether the field is required
min: Option<f64>Minimum value (for numeric types)
max: Option<f64>Maximum value (for numeric types)
min_length: Option<usize>Minimum length (for string types)
max_length: Option<usize>Maximum length (for string types)
allowed_values: Option<Vec<String>>Allowed enum values
Implementations§
Source§impl ConfigFieldSchema
impl ConfigFieldSchema
pub fn new(name: impl Into<String>, field_type: ConfigFieldType) -> Self
pub fn required(self) -> Self
pub fn with_range(self, min: f64, max: f64) -> Self
pub fn with_length(self, min: usize, max: usize) -> Self
pub fn with_allowed_values(self, values: Vec<String>) -> Self
Trait Implementations§
Source§impl Clone for ConfigFieldSchema
impl Clone for ConfigFieldSchema
Source§fn clone(&self) -> ConfigFieldSchema
fn clone(&self) -> ConfigFieldSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ConfigFieldSchema
impl Debug for ConfigFieldSchema
Source§impl<'de> Deserialize<'de> for ConfigFieldSchema
impl<'de> Deserialize<'de> for ConfigFieldSchema
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 ConfigFieldSchema
impl RefUnwindSafe for ConfigFieldSchema
impl Send for ConfigFieldSchema
impl Sync for ConfigFieldSchema
impl Unpin for ConfigFieldSchema
impl UnsafeUnpin for ConfigFieldSchema
impl UnwindSafe for ConfigFieldSchema
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