Rust Axum, binary type returned in handler fn
I have Axum handler which returns Vec<u8>, binary data. The result is often the same so I cache it using dashmap. The issue is dashmap get gives me refrence, so to return it from Axum handler I need to always clone it first to have owned version bytes.clone(). Is it possible to not do it every time? Since I am only reading this data, why Axum needs owned version of it? Is it somehow moved into network socket or something like that? Also is unsafe rust something to get around that ? Or maybe I need to get around it with implementing my own IntoResponse.
Dependency injection in rust + axum without using Mutex?
(I’m sorry in advance, since this problem is a bit hard to put into text)
Dependency injection in rust + axum without using Mutex?
(I’m sorry in advance, since this problem is a bit hard to put into text)
Is it ok to clone a connection pool in rust/axum?
I’m new to rust & axum and trying to wrap my head around setting up a scalable and clean architecture. When running locally, I sometimes notice a lag before the reponse comes in. This could have many reasons, but one thing I’m investigating is how I’m sharing my connection pool.
axum middleware – unable to propagate jwt claims to next handler
I know this looks like a very basic and silly question. But I have been unabele to solve this.
axum 0.7 json extractor with validator crate – how to control errors output to client
I am new to rust (4 months) and new to axum and/or its frameworks (validator).
rust axum – unable to get a simple middleware to attache to a specific route
I am trying to create a simple middleware fn that performs json schema validation, using Axum 0.7.5, as below.
How can I use a local variable as key to insert into a `http::HeaderMap`?
I’m writing a HTTP server using axum
, and am writing a handler. It calls some external program somecommand
, writes some string
to its stdin, and reads stdout. The stdout output is formatted like a HTTP request (i.e. Header: ValuernHeader2: ValuernrnBody
).
How do I copy a string so I can return it from a function in rust?
I’m new to Rust, please bear with me.
When state is assigned in a middleware, Axum states: Service required by bound ‘Router::::layer’
I’m attempting to implement an authentication middleware, but an Axum error occurs whenever I set a state: