You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a follow on to #133 in which I admit I didn't read my own notes. The returned stream from the blob client does is not Sync (and not just Unpin), which limits some of its downstream use (as it can often get passed down the stack). The specific error in my case when I try to return an impl Stream + Send + Sync:
error[E0277]: `dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<dyn StdError + Send + Sync>>> + Send` cannot be shared between threads safely
--> src/provider/mod.rs:315:12
|
315 | Ok(Box::new(resp))
| ^^^^^^^^^^^^^^ `dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<dyn StdError + Send + Sync>>> + Send` cannot be shared between threads safely
|
= help: the trait `Sync` is not implemented for `dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<dyn StdError + Send + Sync>>> + Send`
= note: required because of the requirements on the impl of `Sync` for `Unique<dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<dyn StdError + Send + Sync>>> + Send>`
= note: required because it appears within the type `Box<dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<dyn StdError + Send + Sync>>> + Send>`
= note: required because it appears within the type `Pin<Box<dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<dyn StdError + Send + Sync>>> + Send>>`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {ResumeTy, &'r GetBlobBuilder<'s>, reqwest::Url, http::request::Request<bytes::Bytes>, StatusCode, GetBlobBuilder<'t0>, &'t1 BlobClient, &'t2 (dyn azure_core::HttpClient + 't3), Pin<Box<(dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<(dyn StdError + Send + Sync + 't4)>>> + Send + 't5)>>, ()}`
= note: required because it appears within the type `[static generator@GetBlobBuilder<'<empty>>::execute::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {ResumeTy, &'r GetBlobBuilder<'s>, reqwest::Url, http::request::Request<bytes::Bytes>, StatusCode, GetBlobBuilder<'t0>, &'t1 BlobClient, &'t2 (dyn azure_core::HttpClient + 't3), Pin<Box<(dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<(dyn StdError + Send + Sync + 't4)>>> + Send + 't5)>>, ()}]`
= note: required because it appears within the type `from_generator::GenFuture<[static generator@GetBlobBuilder<'<empty>>::execute::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3, 't4, 't5> {ResumeTy, &'r GetBlobBuilder<'s>, reqwest::Url, http::request::Request<bytes::Bytes>, StatusCode, GetBlobBuilder<'t0>, &'t1 BlobClient, &'t2 (dyn azure_core::HttpClient + 't3), Pin<Box<(dyn Future<Output = std::result::Result<http::response::Response<bytes::Bytes>, Box<(dyn StdError + Send + Sync + 't4)>>> + Send + 't5)>>, ()}]>`
= note: required because it appears within the type `impl Future`
= note: required because it appears within the type `impl Future`
= note: required because it appears within the type `for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, azure_core::prelude::Range, GetBlobBuilder<'r>, &'s GetBlobBuilder<'t0>, impl Future, ()}`
= note: required because it appears within the type `[static generator@GetBlobBuilder<'<empty>>::stream::{closure#0}::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, azure_core::prelude::Range, GetBlobBuilder<'r>, &'s GetBlobBuilder<'t0>, impl Future, ()}]`
= note: required because it appears within the type `from_generator::GenFuture<[static generator@GetBlobBuilder<'<empty>>::stream::{closure#0}::{closure#0} for<'r, 's, 't0, 't1, 't2, 't3> {ResumeTy, azure_core::prelude::Range, GetBlobBuilder<'r>, &'s GetBlobBuilder<'t0>, impl Future, ()}]>`
= note: required because it appears within the type `impl Future`
= note: required because it appears within the type `futures_util::unfold_state::UnfoldState<GetBlobBuilder<'a>::stream::States, impl Future>`
= note: required because it appears within the type `futures_util::stream::unfold::Unfold<GetBlobBuilder<'a>::stream::States, [closure@GetBlobBuilder<'<empty>>::stream::{closure#0}], impl Future>`
= note: required because it appears within the type `impl Stream`
= note: required because it appears within the type `tokio_stream::stream_ext::map::Map<impl Stream, [closure@src/provider/mod.rs:313:18: 313:76]>`
= note: required for the cast to the object type `dyn Stream<Item = std::result::Result<bytes::Bytes, ProviderError>> + Send + Sync + Unpin`
I am guessing if I go back to the code that caused this with my additional rust experience, I can probably find a way to make it not Sync. If I find a good reason, I'll come back
This is a follow on to #133 in which I admit I didn't read my own notes. The returned stream from the blob client does is not
Sync
(and not just Unpin), which limits some of its downstream use (as it can often get passed down the stack). The specific error in my case when I try to return animpl Stream + Send + Sync
:cc @rylev
The text was updated successfully, but these errors were encountered: