pub struct Json<T>(pub T);Expand description
Wraps any Serialize value so a tool can return it as JSON text.
A serialize failure becomes an error output naming the failure.
Use it for structs: Json(Point { x, y }).
Tuple Fields§
§0: TTrait Implementations§
impl<T> Copy for Json<T>where
T: Copy,
impl<T> Eq for Json<T>where
T: Eq,
Source§impl<T> IntoToolOutput for Json<T>where
T: Serialize,
impl<T> IntoToolOutput for Json<T>where
T: Serialize,
Source§fn into_output(self) -> ToolOutput
fn into_output(self) -> ToolOutput
Consumes the value and returns the model-facing output.
Never panics; a value that cannot be rendered becomes an error output.
The output content is the text the model reads.
impl<T> StructuralPartialEq for Json<T>where
T: PartialEq,
Auto Trait Implementations§
impl<T> Forget for Json<T>
impl<T> Freeze for Json<T>where
T: Freeze,
impl<T> Move for Json<T>
impl<T> RefUnwindSafe for Json<T>where
T: RefUnwindSafe,
impl<T> Send for Json<T>where
T: Send,
impl<T> Sync for Json<T>where
T: Sync,
impl<T> Unpin for Json<T>where
T: Unpin,
impl<T> UnsafeUnpin for Json<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Json<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.