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
I have an application which is based internally on Actix actor framework. I would like to refactor it to use warp instead of actix-web, however the issue is the futures incompatibility, because warp expects Send futures and actix uses !Send futures for it's actors.
So the question is whether it is practically doable?
Code example:
asyncfnstatus() -> Result<impl warp::Reply,Infallible>{let res = RemotingServiceActor::from_registry().send(IsOnlineMsg).await;let online = ifletOk(true) = res {"online"}else{"offline"};let reply = warp::reply::with_status(online, warp::http::StatusCode::OK);Ok(warp::reply::with_header(reply,"Context-Type","text/html"))}
...
let status_path = warp::path!("status").and(warp::get()).and_then(status);
commons::spawn(warp::serve(status_path).run(([127,0,0,1],7311)));
Compilation fails with:
508 | let status_path = warp::path!("status").and(warp::get()).and_then(status);
| ^^^^^^^^ future returned by `status` is not `Send`
|
= help: within `impl core::future::future::Future`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<std::cell::RefCell<std::collections::HashMap<std::string::String, futures_channel::oneshot::Sender<domain::proto::remoting::R_RemoteDelivery>>>>`
note: future is not `Send` as this value is used across an await
181 | let res = RemotingServiceActor::from_registry().send(IsOnlineMsg).await;
| -------------------------------------------------------^^^^^^- `RemotingServiceActor::from_registry().send(IsOnlineMsg)` is later dropped here
| |
| await occurs here, with `RemotingServiceActor::from_registry().send(IsOnlineMsg)` maybe used later
| has type `actix::address::message::Request<services::remoting::RemotingService, message::IsOnlineMsg>`
error: future cannot be sent between threads safely
The text was updated successfully, but these errors were encountered:
I have an application which is based internally on Actix actor framework. I would like to refactor it to use warp instead of actix-web, however the issue is the futures incompatibility, because warp expects
Send
futures and actix uses!Send
futures for it's actors.So the question is whether it is practically doable?
Code example:
Compilation fails with:
The text was updated successfully, but these errors were encountered: