pub struct PropSchema {
pub prop_type: PropType,
pub required: bool,
pub default: Option<Value>,
pub values: Option<Vec<String>>,
pub description: Option<String>,
}Expand description
Schema definition for a single prop.
Fields§
§prop_type: PropTypeThe expected type.
required: boolWhether the prop is required.
default: Option<Value>Optional default value (informational; not applied by the validator).
values: Option<Vec<String>>For PropType::Enum, the allowed string values.
description: Option<String>Human-readable description.
Implementations§
Source§impl PropSchema
impl PropSchema
Sourcepub fn enum_required(values: Vec<&str>) -> Self
pub fn enum_required(values: Vec<&str>) -> Self
A required enum prop restricted to specific string values.
Sourcepub fn enum_optional(values: Vec<&str>) -> Self
pub fn enum_optional(values: Vec<&str>) -> Self
An optional enum prop.
Sourcepub fn with_default(self, val: Value) -> Self
pub fn with_default(self, val: Value) -> Self
Set a default value (informational).
Sourcepub fn with_description(self, desc: &str) -> Self
pub fn with_description(self, desc: &str) -> Self
Set a description.
Trait Implementations§
Source§impl Clone for PropSchema
impl Clone for PropSchema
Source§fn clone(&self) -> PropSchema
fn clone(&self) -> PropSchema
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 PropSchema
impl Debug for PropSchema
Source§impl<'de> Deserialize<'de> for PropSchema
impl<'de> Deserialize<'de> for PropSchema
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 PropSchema
impl RefUnwindSafe for PropSchema
impl Send for PropSchema
impl Sync for PropSchema
impl Unpin for PropSchema
impl UnsafeUnpin for PropSchema
impl UnwindSafe for PropSchema
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