pub struct MessageStream { /* private fields */ }Expand description
流式消息(兼容旧 API)
Implementations§
Source§impl MessageStream
impl MessageStream
Sourcepub fn new(response: Response, provider: StreamProvider, model: String) -> Self
pub fn new(response: Response, provider: StreamProvider, model: String) -> Self
创建新的流式消息
Sourcepub async fn next_event(&mut self) -> Result<Option<StreamEvent>>
pub async fn next_event(&mut self) -> Result<Option<StreamEvent>>
获取下一个事件
Sourcepub async fn collect_text(&mut self) -> Result<String>
pub async fn collect_text(&mut self) -> Result<String>
收集所有文本内容
Auto Trait Implementations§
impl !RefUnwindSafe for MessageStream
impl !UnwindSafe for MessageStream
impl Freeze for MessageStream
impl Send for MessageStream
impl Sync for MessageStream
impl Unpin for MessageStream
impl UnsafeUnpin for MessageStream
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