Skip to main content

Response

Trait Response 

Source
pub trait Response {
    // Required methods
    fn content(&self) -> Result<&str>;
    fn created(&self) -> SystemTime;
}
Expand description

响应 trait,为 DeepSeek API 响应提供统一的访问接口

这个 trait 定义了所有响应类型都应该实现的基本操作, 使得用户可以以一致的方式处理不同类型的响应。

Required Methods§

Source

fn content(&self) -> Result<&str>

获取响应的文本内容

§返回

返回响应内容的字符串切片。对于聊天补全响应,这通常是助手的回复文本。

Source

fn created(&self) -> SystemTime

获取响应的创建时间

§返回

返回响应创建的系统时间,可以用于日志记录、缓存控制等场景。

Implementors§