pub struct ToolResult {
pub success: bool,
pub output: Value,
pub error: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
工具执行结果
Fields§
§success: bool是否成功
output: Value输出内容
error: Option<String>错误信息 (如果失败)
metadata: HashMap<String, String>额外元数据
Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub fn success_text(text: impl Into<String>) -> Self
pub fn success_text(text: impl Into<String>) -> Self
创建文本成功结果
Sourcepub fn to_string_output(&self) -> String
pub fn to_string_output(&self) -> String
转换为字符串
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§fn clone(&self) -> ToolResult
fn clone(&self) -> ToolResult
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 Debug for ToolResult
impl Debug for ToolResult
Source§impl<'de> Deserialize<'de> for ToolResult
impl<'de> Deserialize<'de> for ToolResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin for ToolResult
impl UnsafeUnpin for ToolResult
impl UnwindSafe for ToolResult
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