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
0
votes
1 answer

Actix: what's the right way to move shared data into multiple threads?

I have a config Struct that I'm sharing across my actix app like so: pub fn run(addr: &str, pg_pool: PgPool, config: Settings) -> Result { let pool = web::Data::new(pg_pool); let arc_config =…
ilmoi
  • 1,994
  • 2
  • 21
  • 45
0
votes
0 answers

How do I modify actix-web's Query extractor behavior to handle case differences?

The following is an example from actix-web's docs on how to deserialize Query data into a struct: use actix_web::{get, web, App, HttpServer}; use serde::Deserialize; #[derive(Deserialize)] struct Info { username: String, } // this handler gets…
ilmoi
  • 1,994
  • 2
  • 21
  • 45
0
votes
0 answers

How do I resolve “implementation of serde::Deserialize is not general enough” with actix-web's Form type?

I'm building a web server using actix-web. One of my endpoints tries to deserialize the incoming data into a form struct: #[get("/tweets4")] async fn tweets4(form: web::Form>) -> HttpResponse { println!("{} {} {}", form.page,…
ilmoi
  • 1,994
  • 2
  • 21
  • 45
0
votes
1 answer

How to update Actix app_data with POST request?

I am trying to create a Actix server that I want to use as an interface for a global HashMap. I have been able to create a route that returns the entire structure. However, now I am having problems updating the HashMap. I am able to submit and…
bleuj
  • 151
  • 6
0
votes
0 answers

Actix Request Error the trait `std::future::Future` is not implemented for `Request<()>`

I'm very new to Rust and am trying to make a post request to an internal API. I'm getting the error: match request.await { ^^^^^^^^^^^^^ `Request<()>` is not a future = help: the trait `std::future::Future` is not…
AMP_035
  • 167
  • 1
  • 2
  • 13
0
votes
1 answer

Cors headers not set with Actix_Cors using Actix_Web server written in Rust

I have written a web server in Rust using Actix_Web. Im preparing it for production so I wanted to add Cors to the server to improve security. I have used the Actix_Cors package to do that and implemented a test with a basic server. When calling the…
Ultronn
  • 532
  • 1
  • 5
  • 19
0
votes
1 answer

Actix server fails to connect to Postgres when using TLS via deadpool-postgres

I have a web app. I have developed out some basic features in production. I have put it into a live environment, once on Heroku and later on DigitalOcean. In live, the connection to the Postgres database needs to use TLS. In all permutations of code…
MBuscemi
  • 102
  • 8
0
votes
1 answer

Actix web actors are being created more than once

I am just playing a bit with Actix web and Actix actors, while I was building a simple app which gives out milliseconds I observed that Actix is creating more than one actor. I want to restrict it to only one, but I am unable to do it. What's the…
manu
  • 223
  • 1
  • 2
  • 12
0
votes
1 answer

Compilation problem with Actix TCP client implementation

I'm very new to Rust and willing to make some Linux service for Orange Pi Zero in Actix-web, that will act as a "gateway" to other network device (some dumb Chinese network relay with 4 inputs and 4 ouputs which is controlled by AT commands via TCP…
Skyggedans
  • 25
  • 5
0
votes
1 answer

How to create multiple html pages using one main route?

I'm trying to create a website that has multiple community feeds like one for bowling and another for poker like so: localhost:8088/communities/bowling & localhost:8088/communities/poker. I use actix as my webserver operating under the Rust…
Yun Jae Jung
  • 139
  • 1
  • 8
0
votes
0 answers

Actix-web loosely typed JSON to strongly typed structure

I have a case when I need to perform some type conversions on incoming JSON. Different clients send pretty much the same data in different types: {"amount": 49.90} {"amount": "49.90"} My struct & handler: struct Amount { pub amount: f64, } pub…
Alex Smith
  • 311
  • 1
  • 3
  • 14
0
votes
2 answers

Lauch scheduled task with actix and access to self

new on rust, i have some problem to handle async and lifetime in rust. I try to run a scheduled task into an Actix runtime (actix-web) I'm blocked cause of lifetime. I got this errror: error[E0495]: cannot infer an appropriate lifetime for…
Alborq
  • 39
  • 6
0
votes
0 answers

Actix-Web runtime error: thread 'actix-rt:worker:2' panicked at 'AuthenticationMiddleware was called already'

I have an actix-web server using HttpAuthentication middleware to authenticate all requests. The server runs fine and responds correctly to most requests, but occasionally certain requests trigger the error: thread 'actix-rt:worker:2' panicked at…
Jared Forth
  • 1,577
  • 6
  • 17
  • 32
0
votes
1 answer

How to call a function from another file and fetch in web

I'm new to Rust and still I am learning things. There is a rust application with main.rs and routes.rs. main.rs file has server configuration and routes.rs has methods with paths. main.rs #[macro_use] extern crate log; use actix_web::{App,…
Amithash
  • 269
  • 2
  • 4
  • 22
0
votes
1 answer

How to return a mapped future in an actix_web FromRequest trait implementation?

I have the following implementation of the actix_web FromRequest trait: impl ::actix_web::FromRequest for Box { type Error = ::actix_web::Error; type Future = …
Rasmus Hansen
  • 1,502
  • 1
  • 17
  • 28