Questions tagged [rust]
Rust is a systems programming language without a garbage collector focused on three goals: safety, speed, and concurrency. Use this tag for questions about code written in Rust. Use an edition specific tag for questions that refer to code which requires a particular edition, like [rust-2018]. Use more specific tags for subtopics like [rust-cargo] and [rust-macros].
rust
41,922
questions
0
votes
0
answers
26
views
required for `&str` to implement `ToSql<diesel::sql_types::Array<diesel::sql_types::Text>, Pg>`
I'm trying to build a Diesel query that will make the search Postgres field defined as a varchar array similar to this SELECT value FROM table WHERE ANY VALUE IN array_column = 'Carol';
But this ...
0
votes
0
answers
15
views
How can i render a svg-file in dioxus and interact with it?
I have a svg file and want to render it. Then i want to interact with it. Make certain elements invisible or clickable.
#[component]
fn SvgRender() -> Element {
const svg_file: manganis::...
-1
votes
0
answers
25
views
ld: library 'ssl' not found on rust
I try to build in rust with diesel.
When run cargo run An error occurs
error: linking with `cc` failed: exit status: 1
|
= note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -...
0
votes
0
answers
26
views
How can I use imported memory in Rust code targeting `wasm32-unknown-unknown`?
I have the following Rust code:
use wasmer::{
imports, AsStoreRef, Function, FunctionEnv, FunctionEnvMut, Instance, Memory, MemoryType,
Module, Store,
};
const WAT_CODE: &str = r#"
(...
0
votes
0
answers
34
views
Serde doesn't see untagged enum variant in input ("data did not match any variant of untagged ...") [duplicate]
Using Serde, I want to parse JSON data like this:
{
"data_type": "uint8",
"scales": [{
"encoding": "jpeg",
"key": "4.0x4....
-2
votes
0
answers
24
views
Building binaries with qemu or cross building give different binaries [closed]
I've been building a tool written in Rust and I do the release builds with GitHub Action.
Considering I want to release a version for linux amd64 and linux arm64, I need to cross build the binary or ...
-2
votes
0
answers
17
views
strange qeustion about using vscode + wsl2 + codelldb to debug rust program [closed]
env:
OS: windows11 22631.3880
vsocde 1.91.1
wsl2
Unable to debug program using automatically generated configuration by codelldb.
The following is the config:
"version": "0.2.0",
...
0
votes
0
answers
16
views
Execute function and continue control flow with Teloxide
I want to execute some code every time a message is received by my telegram bot and always pass the control to the next branch
let handler = Update::filter_message()
.branch(
dptree::...
-1
votes
0
answers
35
views
POST handler doesnt get invoked when a POST request is sent
new to Rust, Actix and Diesel.
I have been trying to implement a basic route and corresponding handlers to search, insert, delete users from table in Postgre.
The GET requests works Ok and ...
0
votes
0
answers
37
views
Fill a matrix in parallel - how to convert `Vec<Arc<Mutex<Vec<_>>>>` to Vec<Vec<_>>`
I'm learning Rust and just finished the Fearless Concurrency chapter in the Rust book, so am trying to fill up the rows of a matrix in parallel.
My matrix is large, so I send a chunk of rows to each ...
0
votes
0
answers
42
views
What is a good way to keep the SQL queries in a Rust application that uses sqlx?
At the moment I have my SQL queries as a multiline string in my Rust files.
let sql = r#"
SELECT
*
FROM
public.users
...
0
votes
0
answers
26
views
Reading a pdf in rust
I am trying to read a pdf document using lopdf crate. It is working fine in the rest of the cases but in few files, I am getting these logs as
Unicode mismatch true mu "μ" Ok("µ") [...
-1
votes
1
answer
24
views
Question on borrowing in Rust with closures [duplicate]
I am trying a sample program in Rust to understand closures as follows. But I get in error for the line "After defining closure" below.
let mut list = vec![1, 2, 3];
println!("...
1
vote
1
answer
67
views
Side effects of constructing an explicitly unused object
Say I have a struct that provides a method that does some work (has useful side effects) and then returns an instance of itself. Do I have to use that instance somehow in order to guarantee that the ...
0
votes
0
answers
23
views
Minimp3 Rust - "slice::get_unchecked_mut requires that the index is within the slice"
While developing an audio-centered application, I came across an issue with the minimp3/minimp3_fixed crate when using it to decode mp3 files. The error/output looks like this:
Decoding MP3 File.
...