#[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>>,
}Available on crate feature
unstable_elicitation 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
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 title(self, title: impl IntoOption<String>) -> Self
pub fn title(self, title: impl IntoOption<String>) -> Self
Optional title for the property.
Sourcepub fn description(self, description: impl IntoOption<String>) -> Self
pub fn description(self, description: impl IntoOption<String>) -> Self
Human-readable description.
Sourcepub fn min_length(self, min_length: impl IntoOption<u32>) -> Self
pub fn min_length(self, min_length: impl IntoOption<u32>) -> Self
Minimum string length.
Sourcepub fn max_length(self, max_length: impl IntoOption<u32>) -> Self
pub fn max_length(self, max_length: impl IntoOption<u32>) -> Self
Maximum string length.
Sourcepub fn pattern(self, pattern: impl IntoOption<String>) -> Self
pub fn pattern(self, pattern: impl IntoOption<String>) -> Self
Pattern the string must match.
Sourcepub fn format(self, format: impl IntoOption<StringFormat>) -> Self
pub fn format(self, format: impl IntoOption<StringFormat>) -> Self
String format.
Sourcepub fn default_value(self, default: impl IntoOption<String>) -> Self
pub fn default_value(self, default: impl IntoOption<String>) -> Self
Default value.
Sourcepub fn enum_values(self, enum_values: impl IntoOption<Vec<String>>) -> Self
pub fn enum_values(self, enum_values: impl IntoOption<Vec<String>>) -> Self
Enum values for untitled single-select enums.
Sourcepub fn one_of(self, one_of: impl IntoOption<Vec<EnumOption>>) -> Self
pub fn one_of(self, one_of: impl IntoOption<Vec<EnumOption>>) -> Self
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
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 StringPropertySchema
impl Debug for StringPropertySchema
Source§impl Default for StringPropertySchema
impl Default for StringPropertySchema
Source§fn default() -> StringPropertySchema
fn default() -> StringPropertySchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for StringPropertySchema
impl<'de> Deserialize<'de> for StringPropertySchema
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
Source§impl From<StringPropertySchema> for ElicitationPropertySchema
impl From<StringPropertySchema> for ElicitationPropertySchema
Source§fn from(schema: StringPropertySchema) -> Self
fn from(schema: StringPropertySchema) -> Self
Converts to this type from the input type.
Source§impl IntoV2 for StringPropertySchema
Available on crate feature unstable_protocol_v2 only.
impl IntoV2 for StringPropertySchema
Available on crate feature
unstable_protocol_v2 only.Source§impl JsonSchema for StringPropertySchema
impl JsonSchema for StringPropertySchema
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$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
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for StringPropertySchema
impl Serialize for StringPropertySchema
impl StructuralPartialEq for StringPropertySchema
Auto Trait Implementations§
impl Freeze for StringPropertySchema
impl RefUnwindSafe for StringPropertySchema
impl Send for StringPropertySchema
impl Sync for StringPropertySchema
impl Unpin for StringPropertySchema
impl UnsafeUnpin for StringPropertySchema
impl UnwindSafe for StringPropertySchema
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