#[non_exhaustive]pub struct ElicitationSchema {
pub type_: ElicitationSchemaType,
pub title: Option<String>,
pub properties: BTreeMap<String, ElicitationPropertySchema>,
pub required: Option<Vec<String>>,
pub description: Option<String>,
}Available on crate feature
unstable_protocol_v2 only.Expand description
Type-safe elicitation schema for requesting structured user input.
This represents a JSON Schema object with primitive-typed properties, as required by the elicitation specification.
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.type_: ElicitationSchemaTypeType discriminator. Always "object".
title: Option<String>Optional title for the schema.
properties: BTreeMap<String, ElicitationPropertySchema>Property definitions (must be primitive types).
required: Option<Vec<String>>List of required property names.
description: Option<String>Optional description of what this schema represents.
Implementations§
Source§impl ElicitationSchema
impl ElicitationSchema
Sourcepub fn new() -> ElicitationSchema
pub fn new() -> ElicitationSchema
Create a new empty elicitation schema.
Sourcepub fn title(self, title: impl IntoOption<String>) -> ElicitationSchema
pub fn title(self, title: impl IntoOption<String>) -> ElicitationSchema
Optional title for the schema.
Sourcepub fn description(
self,
description: impl IntoOption<String>,
) -> ElicitationSchema
pub fn description( self, description: impl IntoOption<String>, ) -> ElicitationSchema
Optional description of what this schema represents.
Sourcepub fn property<S>(
self,
name: impl Into<String>,
schema: S,
required: bool,
) -> ElicitationSchemawhere
S: Into<ElicitationPropertySchema>,
pub fn property<S>(
self,
name: impl Into<String>,
schema: S,
required: bool,
) -> ElicitationSchemawhere
S: Into<ElicitationPropertySchema>,
Add a property to the schema.
Sourcepub fn string(
self,
name: impl Into<String>,
required: bool,
) -> ElicitationSchema
pub fn string( self, name: impl Into<String>, required: bool, ) -> ElicitationSchema
Add a string property.
Sourcepub fn email(self, name: impl Into<String>, required: bool) -> ElicitationSchema
pub fn email(self, name: impl Into<String>, required: bool) -> ElicitationSchema
Add an email property.
Sourcepub fn uri(self, name: impl Into<String>, required: bool) -> ElicitationSchema
pub fn uri(self, name: impl Into<String>, required: bool) -> ElicitationSchema
Add a URI property.
Sourcepub fn date(self, name: impl Into<String>, required: bool) -> ElicitationSchema
pub fn date(self, name: impl Into<String>, required: bool) -> ElicitationSchema
Add a date property.
Sourcepub fn date_time(
self,
name: impl Into<String>,
required: bool,
) -> ElicitationSchema
pub fn date_time( self, name: impl Into<String>, required: bool, ) -> ElicitationSchema
Add a date-time property.
Sourcepub fn number(
self,
name: impl Into<String>,
min: f64,
max: f64,
required: bool,
) -> ElicitationSchema
pub fn number( self, name: impl Into<String>, min: f64, max: f64, required: bool, ) -> ElicitationSchema
Add a number property with range.
Trait Implementations§
Source§impl Clone for ElicitationSchema
impl Clone for ElicitationSchema
Source§fn clone(&self) -> ElicitationSchema
fn clone(&self) -> ElicitationSchema
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 ElicitationSchema
impl Debug for ElicitationSchema
Source§impl Default for ElicitationSchema
impl Default for ElicitationSchema
Source§fn default() -> ElicitationSchema
fn default() -> ElicitationSchema
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ElicitationSchema
impl<'de> Deserialize<'de> for ElicitationSchema
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ElicitationSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ElicitationSchema, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoV1 for ElicitationSchema
Available on crate feature unstable_elicitation only.
impl IntoV1 for ElicitationSchema
Available on crate feature
unstable_elicitation only.Source§type Output = ElicitationSchema
type Output = ElicitationSchema
The corresponding v1 type.
Source§fn into_v1(
self,
) -> Result<<ElicitationSchema as IntoV1>::Output, ProtocolConversionError>
fn into_v1( self, ) -> Result<<ElicitationSchema as IntoV1>::Output, ProtocolConversionError>
Converts this value into the corresponding v1 type. Read more
Source§impl JsonSchema for ElicitationSchema
impl JsonSchema for ElicitationSchema
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 ElicitationSchema
impl PartialEq for ElicitationSchema
Source§fn eq(&self, other: &ElicitationSchema) -> bool
fn eq(&self, other: &ElicitationSchema) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ElicitationSchema
impl Serialize for ElicitationSchema
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ElicitationSchema
Auto Trait Implementations§
impl Freeze for ElicitationSchema
impl RefUnwindSafe for ElicitationSchema
impl Send for ElicitationSchema
impl Sync for ElicitationSchema
impl Unpin for ElicitationSchema
impl UnsafeUnpin for ElicitationSchema
impl UnwindSafe for ElicitationSchema
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