#[non_exhaustive]pub struct StringPropertySchema {
pub title: Option<String>,
pub description: Option<String>,
pub min_length: Option<u32>,
pub max_length: Option<u32>,
pub pattern: Option<String>,
pub format: Option<StringFormat>,
pub default: Option<String>,
pub enum_values: Option<Vec<String>>,
pub one_of: Option<Vec<EnumOption>>,
}unstable_protocol_v2 only.Expand description
Schema for string properties in an elicitation form.
When enum or oneOf is set, this represents a single-select enum
with "type": "string".
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.title: Option<String>Optional title for the property.
description: Option<String>Human-readable description.
min_length: Option<u32>Minimum string length.
max_length: Option<u32>Maximum string length.
pattern: Option<String>Pattern the string must match.
format: Option<StringFormat>String format.
default: Option<String>Default value.
enum_values: Option<Vec<String>>Enum values for untitled single-select enums.
one_of: Option<Vec<EnumOption>>Titled enum options for titled single-select enums.
Implementations§
Source§impl StringPropertySchema
impl StringPropertySchema
Sourcepub fn new() -> StringPropertySchema
pub fn new() -> StringPropertySchema
Create a new string property schema.
Sourcepub fn email() -> StringPropertySchema
pub fn email() -> StringPropertySchema
Create an email string property schema.
Sourcepub fn uri() -> StringPropertySchema
pub fn uri() -> StringPropertySchema
Create a URI string property schema.
Sourcepub fn date() -> StringPropertySchema
pub fn date() -> StringPropertySchema
Create a date string property schema.
Sourcepub fn date_time() -> StringPropertySchema
pub fn date_time() -> StringPropertySchema
Create a date-time string property schema.
Sourcepub fn title(self, title: impl IntoOption<String>) -> StringPropertySchema
pub fn title(self, title: impl IntoOption<String>) -> StringPropertySchema
Optional title for the property.
Sourcepub fn description(
self,
description: impl IntoOption<String>,
) -> StringPropertySchema
pub fn description( self, description: impl IntoOption<String>, ) -> StringPropertySchema
Human-readable description.
Sourcepub fn min_length(
self,
min_length: impl IntoOption<u32>,
) -> StringPropertySchema
pub fn min_length( self, min_length: impl IntoOption<u32>, ) -> StringPropertySchema
Minimum string length.
Sourcepub fn max_length(
self,
max_length: impl IntoOption<u32>,
) -> StringPropertySchema
pub fn max_length( self, max_length: impl IntoOption<u32>, ) -> StringPropertySchema
Maximum string length.
Sourcepub fn pattern(self, pattern: impl IntoOption<String>) -> StringPropertySchema
pub fn pattern(self, pattern: impl IntoOption<String>) -> StringPropertySchema
Pattern the string must match.
Sourcepub fn format(
self,
format: impl IntoOption<StringFormat>,
) -> StringPropertySchema
pub fn format( self, format: impl IntoOption<StringFormat>, ) -> StringPropertySchema
String format.
Sourcepub fn default_value(
self,
default: impl IntoOption<String>,
) -> StringPropertySchema
pub fn default_value( self, default: impl IntoOption<String>, ) -> StringPropertySchema
Default value.
Sourcepub fn enum_values(
self,
enum_values: impl IntoOption<Vec<String>>,
) -> StringPropertySchema
pub fn enum_values( self, enum_values: impl IntoOption<Vec<String>>, ) -> StringPropertySchema
Enum values for untitled single-select enums.
Sourcepub fn one_of(
self,
one_of: impl IntoOption<Vec<EnumOption>>,
) -> StringPropertySchema
pub fn one_of( self, one_of: impl IntoOption<Vec<EnumOption>>, ) -> StringPropertySchema
Titled enum options for titled single-select enums.
Trait Implementations§
Source§impl Clone for StringPropertySchema
impl Clone for StringPropertySchema
Source§fn clone(&self) -> StringPropertySchema
fn clone(&self) -> StringPropertySchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StringPropertySchema
impl Debug for StringPropertySchema
Source§impl Default for StringPropertySchema
impl Default for StringPropertySchema
Source§fn default() -> StringPropertySchema
fn default() -> StringPropertySchema
Source§impl<'de> Deserialize<'de> for StringPropertySchema
impl<'de> Deserialize<'de> for StringPropertySchema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StringPropertySchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StringPropertySchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<StringPropertySchema> for ElicitationPropertySchema
impl From<StringPropertySchema> for ElicitationPropertySchema
Source§fn from(schema: StringPropertySchema) -> ElicitationPropertySchema
fn from(schema: StringPropertySchema) -> ElicitationPropertySchema
Source§impl IntoV1 for StringPropertySchema
Available on crate feature unstable_elicitation only.
impl IntoV1 for StringPropertySchema
unstable_elicitation only.Source§type Output = StringPropertySchema
type Output = StringPropertySchema
Source§fn into_v1(
self,
) -> Result<<StringPropertySchema as IntoV1>::Output, ProtocolConversionError>
fn into_v1( self, ) -> Result<<StringPropertySchema as IntoV1>::Output, ProtocolConversionError>
Source§impl JsonSchema for StringPropertySchema
impl JsonSchema for StringPropertySchema
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for StringPropertySchema
impl PartialEq for StringPropertySchema
Source§fn eq(&self, other: &StringPropertySchema) -> bool
fn eq(&self, other: &StringPropertySchema) -> bool
self and other values to be equal, and is used by ==.