pub struct StringSchemaBuilder(/* private fields */);
Expand description
Builder for string schemas
Implementations§
Source§impl StringSchemaBuilder
impl StringSchemaBuilder
Sourcepub fn with_title(title: impl Into<String>) -> Self
pub fn with_title(title: impl Into<String>) -> Self
Create with title for maximum ergonomics
Sourcepub fn title(self, title: impl Into<String>) -> Self
pub fn title(self, title: impl Into<String>) -> Self
Set the display title for this string field
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Set the description for this string field
Sourcepub fn min_length(self, len: u32) -> Self
pub fn min_length(self, len: u32) -> Self
Set the minimum length constraint for the string
Sourcepub fn max_length(self, len: u32) -> Self
pub fn max_length(self, len: u32) -> Self
Set the maximum length constraint for the string
Sourcepub fn format(self, format: StringFormat) -> Self
pub fn format(self, format: StringFormat) -> Self
Set the string format hint (email, uri, date, date-time)
Sourcepub fn enum_values(self, values: Vec<impl Into<String>>) -> EnumSchemaBuilder
pub fn enum_values(self, values: Vec<impl Into<String>>) -> EnumSchemaBuilder
Convert to an enum schema with values
Sourcepub fn options<T: AsRef<str>>(self, values: &[T]) -> EnumSchemaBuilder
pub fn options<T: AsRef<str>>(self, values: &[T]) -> EnumSchemaBuilder
World-class DX: Convert to enum schema with array slice (no Vec required!)
Sourcepub fn choices<T: AsRef<str>>(self, values: &[T]) -> EnumSchemaBuilder
pub fn choices<T: AsRef<str>>(self, values: &[T]) -> EnumSchemaBuilder
Alias for options() - even terser naming
Sourcepub fn build(self) -> PrimitiveSchemaDefinition
pub fn build(self) -> PrimitiveSchemaDefinition
Build the string schema into a primitive schema definition
Trait Implementations§
Source§impl Debug for StringSchemaBuilder
impl Debug for StringSchemaBuilder
Source§impl Default for StringSchemaBuilder
impl Default for StringSchemaBuilder
Source§fn default() -> StringSchemaBuilder
fn default() -> StringSchemaBuilder
Returns the “default value” for a type. Read more
Source§impl From<StringSchemaBuilder> for ElicitationSchema
World-class DX: Direct conversion to ElicitationSchema for single field usage
impl From<StringSchemaBuilder> for ElicitationSchema
World-class DX: Direct conversion to ElicitationSchema for single field usage
Source§fn from(val: StringSchemaBuilder) -> Self
fn from(val: StringSchemaBuilder) -> Self
Converts to this type from the input type.
Source§impl From<StringSchemaBuilder> for PrimitiveSchemaDefinition
World-class DX: Eliminate .build() ceremony via Into trait
impl From<StringSchemaBuilder> for PrimitiveSchemaDefinition
World-class DX: Eliminate .build() ceremony via Into trait
Source§fn from(val: StringSchemaBuilder) -> Self
fn from(val: StringSchemaBuilder) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StringSchemaBuilder
impl RefUnwindSafe for StringSchemaBuilder
impl Send for StringSchemaBuilder
impl Sync for StringSchemaBuilder
impl Unpin for StringSchemaBuilder
impl UnwindSafe for StringSchemaBuilder
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