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

How do I extract path parameters and parse JSON body from the same request using Actix-Web

I'm writing a web application in Rust using Actix-Web v1.0.7. I'm trying to create a route handler that could access a path parameter and also parse the JSON body of the request. However, so far I've failed to do so. I tried declaring a handler…
1
vote
1 answer

Problem running actix-web as Windows service

I'm trying to use windows-service to run an actix web app. It provides a nice API and mostly works. I can start my service just fine. However, when I try to stop my service, I get the following error: Error 109: The pipe has been ended (it does stop…
Jacob Brown
  • 7,221
  • 4
  • 30
  • 50
1
vote
1 answer

How do I determine the type annotation while calling MyActor::from_registry() from another actor's handler that doesn't define T?

I have two Actix actors. MyActor1 defines a generic trait that one of its fields implements. MyActor2 doesn't need to define T and I can't figure out how to call MyActor1::from_registry() from MyActor2 message handlers without knowing what type T…
1
vote
1 answer

Actix SyncArbiter registry

I'm trying to implement a pool of 10 Redis of conections using a SyncArbiter for different actors to use. Say that we have an actor named Bob that has to use a Redis actor to accomplish it's task. While this is achievable in the following manner: //…
Stanko
  • 500
  • 5
  • 13
1
vote
1 answer

How can I fix Resource temporarily unavailable error in Rust?

Here's an error log: note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace. thread 'arbiter:724dcce3-b3b3-4523-8b02-3b2e9fa035dd:actix-net-worker-62' panicked at 'called `Result::unwrap()` on an `Err` value: Os {…
Alex
  • 579
  • 1
  • 6
  • 14
1
vote
0 answers

How to inject an immutable object into service code in actix-web?

I'm using actix framework to build a server that should support an opportunity to show both age/balance to a user given a user_id: fn show_balance(req: &HttpRequest) -> HttpResponse { let client = create_client(); let user_id =…
H. Desane
  • 593
  • 1
  • 8
  • 16
1
vote
1 answer

Append data to proxied response in Actix-web

I would like to append user's request data to peroxided response in actix-web, but type mismatch resolving error will happend. I think it's about rust futures but I don't have idea about this problem and how can I fix it. Sample Code : use…
David Tex
  • 87
  • 6
1
vote
1 answer

Actix-web: send message to db handler, conditionally send message to second handler

I am trying to send a message to one db handler, and based on the result send a message to a second handler, or return an error from the first. What I've come up with so far doesn't work; rustc says match arms have incompatible types expected struct…
trolle3000
  • 1,067
  • 2
  • 14
  • 27
1
vote
1 answer

Lifetime issue with Actix Web

I'm implementing middleware with Actix-web and having an issue with lifetime that I couldn't figure out. extern crate actix_web; use actix_web::actix::{Actor, Addr, Context, System}; use actix_web::middleware::Middleware; use actix_web::{http,…
Shulhi Sapli
  • 2,286
  • 3
  • 21
  • 31
1
vote
0 answers

How to map a vector into actix-web client requests and run them sequentially?

I have a vector and I want to make multiple requests and get vector of values. Something like: use actix_web::client; let nums = vec![1, 2, 3]; let values = nums.map(|num| { client::ClientRequest::get("http://example.com".to_owned() +…
rofrol
  • 14,438
  • 7
  • 79
  • 77
1
vote
1 answer

How to deserialize messages within Actix actors?

My intention is receiving events through WebSockets and use them on the closures of main. This works when the messages are pure text (String), but the idea is deserializing that text into some structs. In this example I've added only Data, Error and…
Deveres
  • 97
  • 7
1
vote
2 answers

How can actix Actor have PyO3 Python?

I'm trying to create Actix Actor which has PyO3 Python interpreter & Py objects. Question is what is the correct way to create python interpreter actor? I think err caused by Actor trait defined…
1
vote
1 answer

Timeout on tests using working POST route with actix-web

I've successfully migrated a web application from Rocket to actix-web. By utilizing postman, I've verified that the same requests yield the same responses. Migrating the tests however has been proven to be a little bit more tricky. My POST requests…
manonthemat
  • 6,101
  • 1
  • 24
  • 49
0
votes
0 answers

Create new response in actix_web middleware

i try to create new response without sucess this is what i got : use std::{future::{ready, Ready}, intrinsics::mir::StaticMut}; use actix_http::{header::{self, HeaderName, HeaderValue}}; use actix_web::{ dev::{self, Service, ServiceRequest,…
user63898
  • 29,839
  • 85
  • 272
  • 514
0
votes
0 answers

Getting expected `HttpResponse` , found `HttpResponse` in actix web middleware

i am trying to create a middleware to validate jwt token using actix web . Here is the middleware .This tends to get the Bearer token from the header and validate it and add the user struct to the request if validated , other wise it throw and error…
Biswas Sampad
  • 413
  • 1
  • 6
  • 19