| Crates.io | elicitation_derive |
| lib.rs | elicitation_derive |
| version | 0.4.3 |
| created_at | 2025-12-28 20:24:36.430777+00 |
| updated_at | 2026-01-19 07:32:01.070287+00 |
| description | Derive macros for elicitation library |
| homepage | https://github.com/crumplecup/elicitation |
| repository | https://github.com/crumplecup/elicitation |
| max_upload_size | |
| id | 2009339 |
| size | 57,871 |
Derive macros for the elicitation library.
This crate provides procedural macros for automatically implementing elicitation traits on custom types. It's typically used through the main elicitation crate.
#[derive(Elicit)] - Automatic implementation of elicitation traitsSelect pattern for unit variant enumsSurvey pattern for structs#[prompt("...")], #[skip], and moreAdd this to your Cargo.toml:
[dependencies]
elicitation = "0.2"
The derive macro is re-exported through the main crate:
use elicitation::Elicit;
#[derive(Debug, Elicit)]
enum Priority {
Low,
Medium,
High,
}
#[derive(Debug, Elicit)]
struct Task {
#[prompt("What's the task title?")]
title: String,
priority: Priority,
}
#[prompt("...")]Customize the prompt text for types or fields:
#[derive(Elicit)]
#[prompt("Choose your favorite color:")]
enum Color {
Red,
Green,
Blue,
}
#[derive(Elicit)]
struct Config {
#[prompt("Enter the server hostname:")]
host: String,
}
#[skip]Skip a field during elicitation (uses Default::default()):
use chrono::{DateTime, Utc};
#[derive(Default, Elicit)]
struct Task {
title: String,
#[skip]
created_at: DateTime<Utc>,
}
#[derive(Elicit)]
enum Status {
Active,
Inactive,
}
Generates:
impl Prompt for Statusimpl Select for Statusimpl Elicitation for Status#[derive(Elicit)]
struct Person {
name: String,
age: u8,
}
Generates:
impl Prompt for Personimpl Survey for Personimpl Elicitation for PersonElicitationDefault if using #[skip] attributeSee CHANGELOG.md for version history.
Licensed under either of:
at your option.