Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make stream is send #10

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/chat/chat_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use futures::Stream;
use std::pin::Pin;
use std::task::{Context, Poll};

type InterStreamType = Pin<Box<dyn Stream<Item = crate::Result<InterStreamEvent>>>>;
type InterStreamType = Pin<Box<dyn Stream<Item = crate::Result<InterStreamEvent>> + Send>>;

/// ChatStream is a Rust Future Stream that iterates through the events of a chat stream request.
pub struct ChatStream {
Expand All @@ -19,7 +19,7 @@ impl ChatStream {

pub fn from_inter_stream<T>(inter_stream: T) -> Self
where
T: Stream<Item = crate::Result<InterStreamEvent>> + Unpin + 'static,
T: Stream<Item = crate::Result<InterStreamEvent>> + Send + Unpin + 'static,
{
let boxed_stream: InterStreamType = Box::pin(inter_stream);
ChatStream::new(boxed_stream)
Expand Down
4 changes: 2 additions & 2 deletions src/webc/web_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use std::task::{Context, Poll};
pub struct WebStream {
stream_mode: StreamMode,
reqwest_builder: Option<RequestBuilder>,
response_future: Option<Pin<Box<dyn Future<Output = Result<Response, Box<dyn Error>>>>>>,
bytes_stream: Option<Pin<Box<dyn Stream<Item = Result<Bytes, Box<dyn Error>>>>>>,
response_future: Option<Pin<Box<dyn Future<Output = Result<Response, Box<dyn Error>>> + Send>>>,
bytes_stream: Option<Pin<Box<dyn Stream<Item = Result<Bytes, Box<dyn Error>>> + Send>>>,
// If a poll was a partial message, so we kept the previous part
partial_message: Option<String>,
// If a poll retrieved multiple messages, we keep to be sent in next poll
Expand Down