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

Failed to create record in SurrealDb

I'm trying to build a simple CRUD Api using actix web and surrealdb as my datastore. But I ran into a strange problem when trying to add a new record. I tried to send the following json to the api: { "zipcode":"00-001", "city":"Warsaw", …
mmich
  • 101
  • 1
  • 8
0
votes
1 answer

url params if Vec in actix web

i am current trying to make i api in actix web and get the current params of the url my current ApiParams #[serde_with::skip_serializing_none] #[derive(Debug,Serialize,Deserialize)] pub struct ApiParams { pub name: Option, pub fname:…
0
votes
0 answers

Actix Web Wrap fn for session cookie

I am trying to create a security checker if the current request has a valid session cookie. I already have this code: .wrap_fn(|rq, srv| { async move { let res = rq.cookie("sessionid").clone(); if…
Samuel
  • 547
  • 1
  • 3
  • 14
0
votes
0 answers

Why is RocksDB slower when using app_data in Actix Web?

I have a RocksDB + Actix Web setup like this: use actix_web::{get, web, App, HttpResponse, HttpServer, Responder, error}; use rocksdb::DB; use std::sync::Arc; use env_logger; #[derive(Clone)] struct TestDb { db:…
0
votes
1 answer

Calling async functions within an Actix Web WebSocket Interval

I'm trying to run async code within an Actix Web WebSocket interval, but I can't figure out how to do so. I read this question, but I'm not sure if I should take the same approach to my problem as it is slightly different in terms of its design and…
ImTheSquid
  • 365
  • 6
  • 15
0
votes
0 answers

Example of add_stream for Actix

I have not found examples of how to make an actor receive messages coming from a TcpStream which uses Framed trait to encode and decode messages. impl Actor for AuthClient { type Context = Context; fn started(&mut self, ctx: &mut…
0
votes
0 answers

Make Http BasicAuth in Actix Web optional

I'd like to make the Http Basic Auth request optional. Here is a minimal working code example to get started: async fn validator( req: ServiceRequest, _credentials: BasicAuth, ) -> Result { …
Samuel
  • 547
  • 1
  • 3
  • 14
0
votes
0 answers

Actix hosted React App 400 on Javascript file

I get a 400 Bad Request in the Chrome Browser when the JavaScript file should be downloaded from the web server. The actix web server is configured like this App::new().service(fs::Files::new ("/podcasts",…
Samuel
  • 547
  • 1
  • 3
  • 14
0
votes
0 answers

Why is actix-session not correctly assigning values?

I am newbie to Rust, and I am developing a Rust HTTP API with Actix Web. In order to maintain the session between requests, I wanted to use the official-provided package Actix Session, currently, this is my implementation on…
João
  • 3
  • 1
0
votes
1 answer

Actix Message Returning Tuple of Two Things Including Vec

I have tried to make a minimum reproducing example; I don't think I can make it smaller: /* [dependencies] actix-web = "4" actix = "0.13.0" actix-web-actors = "4.2.0" actix-files = "0.6.2" bytestring = "1.2.0" */ use actix::Actor; struct…
lmat - Reinstate Monica
  • 7,289
  • 6
  • 48
  • 62
0
votes
1 answer

How to store data connection for later use by http request

I am building a backend application that uses a S3 bucket as main data provider and Rust's actix-web as web framework. The bucket connection and the credentials are configured in my main() function, but I am struggling to pass the initialised bucket…
mxcd
  • 1,954
  • 2
  • 25
  • 38
0
votes
1 answer

Implement actix_web::Responder trait on a custom structure

I'm using actix-web v4. I'm trying to implement a web service with a custom structure for handling errors: pub struct ApiError { pub message: String, pub code: ErrorEnum, pub details: Vec, } This is an example of function…
Xobtah
  • 464
  • 7
  • 20
0
votes
0 answers

Actix and Inventory crate

I'm trying to make it possible to register an actix route automatically. To do so I found the crate Inventory which seems to answer my need. I have the following code: #[get("/hello2/{name}")] async fn greet2(req: HttpRequest) -> String { let…
ABC
  • 36
  • 3
0
votes
0 answers

Actix-web unable to send Set-Cookie

So i use actix web on the backend and svelte on the frontend This sends the cookie to the frontend let cookie = auth_authority.create_signed_cookie(UserClaims { id: o.id, role: Role::User, …
Snek
  • 141
  • 1
  • 7
0
votes
1 answer

Shared mutable state with websockets in Rust

I am using actix-web to run a webserver and want to be able to mutate state through websocket messages. My current way of using websockets is through implementing the handle method from actix::StreamHandler. However this limits my ability of passing…
LBlend
  • 31
  • 1
  • 4