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
Err(200)? is expanded by try_stream! to something like __yield_tx.send(::core::result::Result::Err(200).await;
This makes the stream !Send.
note: future is not `Send` as this value is used across an await
This can be fixed if async-stream captures the error and tx.send in the outermost block.
let result = Result<_,_> = || {
.. user code ..
};match result {Ok(..) => ..
Err(err) => __yield_tx.send(..).await;}
try-block
A workaround is to capture the error in result: Result<..> and emit the error after MutexGuard is dropped.
However, async-stream does not recognize ? in try-blocks.
try_stream!{let result = {let _guard = mutex.try_lock().unwrap();
let result: Result<..> = try {Err(200)?; // async-stream expands this to `tx.send(..)`.Ok(())};
result
};
result?;
{
yield 100;
}}
The text was updated successfully, but these errors were encountered:
Err(200)?
is expanded by try_stream! to something like__yield_tx.send(::core::result::Result::Err(200).await;
This makes the stream
!Send
.This can be fixed if async-stream captures the error and
tx.send
in the outermost block.A workaround is to capture the error in
result: Result<..>
and emit the error afterMutexGuard
is dropped.However, async-stream does not recognize
?
in try-blocks.The text was updated successfully, but these errors were encountered: