Questions tagged [rust-actix]

Actix is a rust library built on the Actor Model which allows applications to be written as a group of independently executing but cooperating "Actors" which communicate via messages.

Actix (source code) is a Rust actors framework.

233 questions
1
vote
0 answers

How to access A from actix::Addr?

I found myself a bit lost while reading the rust docs, right now I'm unable to find a way to extract A from actix::Addr, I also don't know if that is possible or not. Rust playground Important part: pub struct WebsocketManager { pub clients:…
Patrick José Pereira
  • 1,613
  • 2
  • 11
  • 12
1
vote
1 answer

Actix-web 2.0 JsonConfig error_handler not working

I have this below code, everything works expect the error_handler. I'm not sure whats wrong. If I make post request with correct format I get 200 with response data. But on bad request I'm expecting 400 with JSON data which is not receiving. It just…
STEEL
  • 8,955
  • 9
  • 67
  • 89
1
vote
0 answers

Why would a test thread using actix-lua panic as expected but the test never completes?

I am working on tests using the actix-lua crate: #[should_panic] #[test] fn lua_actor_user_error() { let system = System::new("test"); let lua_addr = lua_actor_with_handle( r#" print("before") error("foo") …
Njuguna Mureithi
  • 3,506
  • 1
  • 21
  • 41
1
vote
1 answer

Using Actix Identity with Juniper GraphQL

I use Actix Identity with Cookie Policy to store user session and about to migrate from REST to GraphQL using Juniper. It would be great to create a login endpoint in GraphQL by using actix identity. Using Juniper in Actix, I've to move GraphQL…
SaltyAom
  • 81
  • 2
  • 4
1
vote
1 answer

How to create a POST method using Actix on Rust?

I'm investigating a way to port a micro-service from Ruby to Rust. My framework of choice is Actix (but anyone else would work without issues). Now, I'm trying to understand how to create a POST method, that receive two JSON as input. Those two…
Paco V.
  • 87
  • 7
1
vote
1 answer

Actix Rust deadpool_postgres: DB connections not released

I've got an Actix-web server that connects to a Postgres DB. I've noticed that after a 1000 requests my Postgres DB's RAM usage has spiked. When I stop actix-web, the RAM held by the db is cleared. This leads me to believe that my code is not…
Werner Raath
  • 1,322
  • 3
  • 16
  • 34
1
vote
1 answer

How to return closure from function in Rust language?

I am pretty new to Rust language and trying to make with Actix web framework. Now I want to return following closure from one function let list = || { App::new() // enable logger .wrap(middleware::Logger::default()) …
Amber More
  • 131
  • 1
  • 15
1
vote
1 answer

How to deserialize actix web form data and serialize it into csv file?

How to deserialize actix_web Form data and serialize it into csv file? Is it possible to use one struct for it? How to cover csv error scenario? I'm trying to save form data x-www-form-urlencoded into csv file in my first Rust program but this…
luzny
  • 2,380
  • 7
  • 30
  • 64
1
vote
0 answers

Coordinate a queue and threads in Rust?

I'm trying to implement the following flow in Rust: an entry (JSON) is submitted to an Actix web listener and processed the entry is submitted to an "observable queue" An Actix Web client is notified The client sends it off (via HTTP) to a…
stwissel
  • 20,110
  • 6
  • 54
  • 101
1
vote
0 answers

How to solve this reqwest header error or API error in Rust

I am creating a Rust web application. I am trying to make API requests and pass a result from a request as Response to the web view. There are main.rs , route.rs and common.rs files. Basically the main.rs file calls the relevant route and then the…
Amithash
  • 269
  • 2
  • 4
  • 22
1
vote
0 answers

Using application state with a lifetime parameter causing issue with lifetimes in rust compiler

I have defined the application state to have a lifetime parameter, as below: pub struct ServiceState<'a> { pub db: sync::Mutex>, } impl<'a> ServiceState<'a> { pub async fn new() -> Result, Error> { let…
Marcus Ruddick
  • 9,795
  • 7
  • 28
  • 43
1
vote
1 answer

Why can I not load the page from the Actix documentation sample?

I'm learning the Actix framework. The documentation has the sample: use actix_rt::System; use actix_web::{web, App, HttpResponse, HttpServer}; use std::sync::mpsc; use std::thread; #[actix_rt::main] async fn main() { let (tx, rx) =…
1
vote
1 answer

Why can actix_rt be used directly in the code, even if it wasn't declared?

I just added actix_rt in Cargo.toml and didn't declare it at the first line with the use keyword. Then I could use it in the code. I know some frequently used functions are included in the prelude of Rust, but I had no idea 3rd party libraries could…
Brad C
  • 25
  • 3
1
vote
1 answer

How can I call a Pinned future from an actix handler?

I have an async trait method which returns a std Future: Pin, Box<(dyn Error + 'static)>>> + Send>> ResultType is an associated type of the trait which is Sync + Send. Note that this type is not…
1
vote
0 answers

Will Actix handle HTTP/2 websocket upgrade automatically if SSL supplied?

I was wondering if it's possible in Actix to upgrade an HTTP/2 and use websocket with binary data exchange. I'm currently following the example provided here: https://github.com/actix/examples/blob/master/websocket/src/main.rs According to the…
ddibiase
  • 1,412
  • 1
  • 20
  • 44