pub enum StandardResponse<T = Value>{
Confirmed {
value: bool,
},
Text {
value: T,
},
Selected {
values: Vec<T>,
},
Custom {
data: T,
},
Cancelled,
}Expand description
Standard response types matching StandardRequest.
Each variant corresponds to a request type:
| Request | Response |
|---|---|
Confirm | Confirmed { value: bool } |
Prompt | Text { value: T } |
Select | Selected { values: Vec<T> } |
| Any | Cancelled (user cancelled) |
The type parameter T defaults to serde_json::Value for backwards compatibility.
§Wire Format
Uses internally-tagged JSON for consistency with TypeScript clients:
{ "type": "confirmed", "value": true }
{ "type": "text", "value": "user-input" }
{ "type": "selected", "values": ["dev"] }
{ "type": "cancelled" }Variants§
Confirmed
User confirmed (true) or declined (false).
Response to StandardRequest::Confirm.
value: true= user said yesvalue: false= user said no
Text
User entered text or provided a value.
Response to StandardRequest::Prompt.
May be empty if user submitted without entering text.
Fields
value: TThe value entered or provided by the user
Selected
User selected one or more options (by value).
Response to StandardRequest::Select.
Contains the value field(s) from selected SelectOptions.
- For single-select: vector with exactly one element
- For multi-select: vector with zero or more elements
Custom
Custom domain-specific response payload.
Corresponds to StandardRequest::Custom or any request type
where the application needs to return a custom response.
Fields
data: TThe custom response data.
Cancelled
User cancelled the request.
Can be sent in response to any request type. Indicates the user chose to abort rather than respond. This is different from declining (Confirmed { value: false }) - cancel means “don’t proceed with the workflow at all”.
Trait Implementations§
Source§impl<T> Clone for StandardResponse<T>
impl<T> Clone for StandardResponse<T>
Source§fn clone(&self) -> StandardResponse<T>
fn clone(&self) -> StandardResponse<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for StandardResponse<T>
impl<T> Debug for StandardResponse<T>
Source§impl<'de, T> Deserialize<'de> for StandardResponse<T>
impl<'de, T> Deserialize<'de> for StandardResponse<T>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardResponse<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardResponse<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<T> JsonSchema for StandardResponse<T>
impl<T> JsonSchema for StandardResponse<T>
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl<T> PartialEq for StandardResponse<T>
impl<T> PartialEq for StandardResponse<T>
Source§impl<T> Serialize for StandardResponse<T>
impl<T> Serialize for StandardResponse<T>
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,
impl<T> StructuralPartialEq for StandardResponse<T>
Auto Trait Implementations§
impl<T> Freeze for StandardResponse<T>where
T: Freeze,
impl<T> RefUnwindSafe for StandardResponse<T>where
T: RefUnwindSafe,
impl<T> Send for StandardResponse<T>where
T: Send,
impl<T> Sync for StandardResponse<T>where
T: Sync,
impl<T> Unpin for StandardResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for StandardResponse<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for StandardResponse<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more