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
0 answers

unifying futures::future::map::Map and futures::future::result_::FutureResult

I am using the following actix handler: fn callback(info: web::Query, session: Session) -> impl Future Inside this function I do some branching and sometimes I return: web::block(||…
simao
  • 14,491
  • 9
  • 55
  • 66
0
votes
2 answers

Does the Rust Actix Web support MongoDB?

I have a new Backend Learning by Rust Programming. Starting from Web Framework. Since I would like to use Rust Backend with MongoDB so I have the example code of Nickel. Anyway, I also see that there is Actix Web Framework. Does Actix Web support…
sirisakc
  • 892
  • 2
  • 15
  • 30
0
votes
1 answer

Error handling and conditional chaining of Actix actors

This is my first attempt at writing a small webservice with rust, using actix-web. The code below is a request handler that is intended to do three things, insert an entry in the database, send an email if that db call was successful, and then…
States
  • 548
  • 5
  • 15
0
votes
0 answers

Served JavaScript file is blank

I'm setting up an Actix server that will host a variety of static files with the traffic of the web applications running through this single server. When I try to serve a file however, it will serve my assets folder and my HTML file but not my…
Ray Kochenderfer
  • 333
  • 1
  • 6
  • 15
0
votes
0 answers

How to process files from actix-multipart data without saving it to the disk

The suggested way by actix-web to treat files from multipart/form-data is to save them to fs, but I'd like to make some preparations like guessing format, making thumbnail, calc a hash etc. Is there a way not to rewrite all the chain of functions…
unegare
  • 2,197
  • 1
  • 11
  • 25
0
votes
1 answer

How to make POST request by curl with an array of a map for actix-from-data?

I'm attempting to send POST request by curl with an array of map. How it should be written? I wrote: curl -X POST -H "Content-Type: multipart/form-data" -F files[]="name=\"qqq\"" localhost:8080/upload But it returns a Found field with unexpected…
unegare
  • 2,197
  • 1
  • 11
  • 25
0
votes
1 answer

How to use actix_web::guard::Header?

In order to support application/json and multipart/form-data on the same URL, I would like to check the "Content-Type" header and choose a proper Data type to hand in to the .data function of App::new. If I uncomment the .guard line, then curl…
unegare
  • 2,197
  • 1
  • 11
  • 25
0
votes
0 answers

Rust - Passing Trait Objects to Threads

I've been struggling with this for a while now and just going in circles, so I'm hoping someone can point out where I'm going wrong. I'm playing with Actix Web, and setting up my first handlers - which is a simple Healthcheck of the system. So what…
Graham
  • 4,095
  • 4
  • 29
  • 37
0
votes
0 answers

Trouble understanding E0277

I am having trouble understanding why I am running into error E0277. I have the following code: #[derive(Queryable, Identifiable, Serialize, Deserialize)] pub struct User { pub id: i32, pub email: String, pub password: String, pub…
rykeeboy
  • 645
  • 2
  • 8
  • 22
0
votes
1 answer

How can I `flatmap` streams in Rust?

I have a rusoto_core::ByteStream which implements futures' Stream trait: let chunks = vec![b"1234".to_vec(), b"5678".to_vec()]; let stream = ByteStream::new(stream::iter_ok(chunks)); I'd like to pass it to actix_web's HttpResponseBuilder::streaming…
H. Desane
  • 593
  • 1
  • 8
  • 16
0
votes
1 answer

How can I create an application/json HTTPResponse in actix?

In the example section, they use: HttpResponse::Ok() .content_type("text/plain") .body(format!("Hello {}!", req.match_info().get("name").unwrap())) Yet I don't like to hardcode my content-type since there's a nice class that shows I can use…
James Larkin
  • 541
  • 5
  • 18
0
votes
1 answer

Cannot use the futures-util crate with Actix because the trait Future is not implemented

Scala has a way to convert a iterable of futures to a single future of iterables via Futures.sequence I was searching for same in Rust and found the futures_util crate. I used this crate in a program edited from the Actix example, but it failed to…
manu
  • 223
  • 1
  • 2
  • 12
0
votes
1 answer

Multiple actix-web client requests - expected struct actix_web::Error found ()

I have this code: extern crate actix; extern crate actix_web; extern crate env_logger; extern crate futures; // 0.1.25 extern crate tokio; // 0.1.17 use futures::future::ok as fut_ok; use futures::Future; use tokio::runtime::Builder; use…
rofrol
  • 14,438
  • 7
  • 79
  • 77
0
votes
1 answer

Cannot build actix-web 0.7.8 using Rust 1.25 on the Windows Subsystem for Linux

I'm trying to play around with the "actix-web" crate using Cargo. I'm using the WSL version of Ubuntu on Windows 10. Steps I ran: Install Cargo (and Rust with it) using sudo apt install cargo Created a project using cargo new hello Added actix-web…
Ash42
  • 73
  • 1
  • 7
0
votes
1 answer

Return a JsonValue object from an actix-web HttpRequest

I'm reading the examples of actix-web, but as I am quite new to Rust I am having some issues understanding how to adapt the code to my needs. Given an actix-web HttpRequest, I want to parse the payload and return a JsonValue. I can't figure out how…
Simen Russnes
  • 2,002
  • 2
  • 26
  • 56
1 2 3
15
16