pub trait ElicitationStyle:
Clone
+ Send
+ Sync
+ Default
+ 'static { }Expand description
Trait for elicitation style types.
Style types define how a type should be elicited. Each type has a default style, but users can define custom styles and apply them at runtime.
§Requirements
Clone: Styles must be cloneable for context storageSend + Sync: Styles must be thread-safeDefault: Provides fallback when no style is specified'static: Required for type-erased storage
§Example
ⓘ
use elicitation::{ElicitationStyle, Elicitation, ElicitClient, ElicitResult};
// Define a custom style for i32
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum MyI32Style {
#[default]
Terse,
Verbose,
}
impl ElicitationStyle for MyI32Style {}
impl Elicitation for MyI32Style {
type Style = Self;
async fn elicit(client: &ElicitClient) -> ElicitResult<Self> {
// Implement selection logic
Ok(Self::default())
}
}
// Use it:
let client = base_client.with_style::<i32, _>(MyI32Style::Verbose);
let value = i32::elicit(&client).await?;Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.