pub struct AsStructured<T>(pub T);Expand description
Wrapper for structured (JSON) output when using #[clap_mcp_output_from].
Use when your run function returns a type that implements Serialize but is not String/&str.
Fully supported when used as the Ok type in Result<AsStructured<T>, E>; there are no known
limitations for mixed success/error types. IntoClapMcpResult is implemented for
AsStructured<T> where T: Serialize.
§Example
ⓘ
fn run(cmd: Cli) -> Result<clap_mcp::AsStructured<SubcommandResult>, Error> {
match cmd { ... }
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for AsStructured<T>
impl<T: Clone> Clone for AsStructured<T>
Source§fn clone(&self) -> AsStructured<T>
fn clone(&self) -> AsStructured<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for AsStructured<T>
impl<T: Debug> Debug for AsStructured<T>
Source§impl<T: Serialize> IntoClapMcpResult for AsStructured<T>
impl<T: Serialize> IntoClapMcpResult for AsStructured<T>
fn into_tool_result(self) -> Result<ClapMcpToolOutput, ClapMcpToolError>
Auto Trait Implementations§
impl<T> Freeze for AsStructured<T>where
T: Freeze,
impl<T> RefUnwindSafe for AsStructured<T>where
T: RefUnwindSafe,
impl<T> Send for AsStructured<T>where
T: Send,
impl<T> Sync for AsStructured<T>where
T: Sync,
impl<T> Unpin for AsStructured<T>where
T: Unpin,
impl<T> UnsafeUnpin for AsStructured<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for AsStructured<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
Mutably borrows from an owned value. Read more