Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

I am creating a QueryBuilder, so I though that it w'd be amazing to serialize objects to tokens, and have an AST within the QueryBuilder. So I immediatly though about the Visitor Design Pattern. Here'...
Alex Vergara's user avatar
  • 2,335
0 votes
0 answers
19 views

I've tried the rust iced framework and tried to create a markdown view from the documentation and the code compiles and renderes the windows but the code pub fn new() -> Self { Self { ...
devMe's user avatar
  • 501
0 votes
1 answer
37 views

I have the following implementation of to_file for a struct which takes a parameter with AsRef<Path>: pub fn to_file(&self, path: impl AsRef<Path>) -> anyhow::Result<()> { ...
glades's user avatar
  • 5,394
-2 votes
0 answers
29 views

I was trying to compile some heavily generic code in a project. I am getting a top level error that makes no sense, in particular: error[E0277]: the trait bound `S: linear_isomorphic::InnerSpace<S&...
Makogan's user avatar
  • 10k
1 vote
0 answers
46 views

I'm using Arch Linux with Wayland. My terminal is Kitty. I'm trying to create an animation using the Kitty Graphics Protocol. However, I want this animation to cover the whole screen and run at 60 fps....
johny's user avatar
  • 42
Best practices
0 votes
1 replies
40 views

Is there a way that I can have a reference to a variable while allowing that variable to be mutated in Rust, so long as I "pinky promise not to access the data of the stored variable" so ...
ViperZer0's user avatar
Best practices
0 votes
4 replies
39 views

I can't help thinking this is not an uncommon idiom and I'm just being an idiot but I've spent ages searching SO and reading the docs for std::iter and for the itertools crate and have got nowhere. ...
Halzephron's user avatar
-2 votes
1 answer
72 views

I'm new learning rust and this is an issue with BufReader.read_line(). In the official documentation it says "This function will read bytes from the underlying stream until the newline delimiter (...
Sun Shuo's user avatar
0 votes
0 answers
54 views

I have a list of elements in an array in which I'm looking for a sequence. Using std::vec::windows::any, I was able to confirm presence/absence of a given sequence. I'm facing an issue if there are ...
Harry's user avatar
  • 4,198
0 votes
0 answers
39 views

I've got a working Rust cross-compile setup on Arch Linux, targeting x86_64-unknown-linux-musl and aarch64-unknown-linux-musl from a x86_64 host. By default, binaries for both targets are fully ...
cyqsimon's user avatar
  • 4,048
6 votes
1 answer
191 views

I am using Rust to target a baremetal system. My startup code is written in Assembly and is in crt0.S, it is shared between Rust, C and Assembly projects. crt0.S contains: #include "constants.h&...
Toby Jaffey's user avatar
Best practices
0 votes
4 replies
73 views

I have a couple of shutdown methods looking like: pub async fn shutdown(self) { self.cancel.cancel(); let _ = self.join.await; } Should i ignore the value returned from join or ...
Walentyn's user avatar
0 votes
1 answer
37 views

I've been working on the 'multiplication / division and general expressions' portion of my parser in Rust complains that () is not an iterator when I try to fold over the repeated operator-expr pairs. ...
Liam Smith's user avatar
-4 votes
1 answer
36 views

I was working on my Tauri project when I came across this error when I ran npm run tauri dev : error[E0515]: cannot return value referencing temporary value --> src/main.rs:209:97 | 209 | ...
Cheesecake's user avatar
Best practices
0 votes
2 replies
93 views

Why is the blocking thread pool (spawn_blocking) better suited for CPU-heavy work than the I/O executor threads, even if my runtime has many worker threads? In the example, both IO executor and CPU ...
nz_21's user avatar
  • 7,781
0 votes
0 answers
34 views

I'm working on a reasonably complex project that is using flatbuffers to serialize data to be used through FFI. The project incorporates several languages, but most of the heavy lifting, including ...
Fluster.IO's user avatar
-3 votes
0 answers
61 views

I’m building a server in Rust using Axum where I need to generate a folder-tree structure of a user’s Google Drive. I fetch all files and folders for each connected Google account and then try to ...
Parth Bhosle's user avatar
Advice
0 votes
3 replies
61 views

I wrote some Rust code and also wrote some test code in the tests submodule. Then I run `cargo llvm-cov --open` to test. But it keeps saying that my code below has branch coverage completion. #[test] ...
Lisery's user avatar
  • 59
1 vote
1 answer
63 views

I want to make a custom polars plugin which takes a class defined in rust using pyo3. I have managed to create a class which can roundtrip pickle defined as: #[pyclass(module = "mylib._internal&...
thoooooooomas's user avatar
Advice
0 votes
1 replies
50 views

Hi I'm using axum as my rust HTTP server, which takes bytes and persist in my backend (you could think of it as S3). The client side request is usually ~16MiB, so - every time I received from server ...
Tinyden's user avatar
  • 604
1 vote
1 answer
86 views

I wanted to quickly make an alias type iterable in rust. Here's what I have: #[derive(Debug, Clone)] struct SSHDomains { hostname: String, path: String, } #[derive(Iter, IntoIter)] pub struct ...
glades's user avatar
  • 5,394
3 votes
2 answers
83 views

In GCC we can specify -fPIC option for shared library and -fPIE for executable to create code that can be executed at any memory address. How do I achieve the same in Rust using Cargo?
Harry's user avatar
  • 4,198
1 vote
0 answers
108 views

Problem Description I am trying to install Rust through rustup in WSL2, but in some distributions any curl request to https://sh.rustup.rs fails with a TLS error. Command: curl --proto '=https' --...
MioMelliot's user avatar
-1 votes
0 answers
82 views

so we read the cookie, to give it to the page, #[get("/hub")] fn hub(cookies: &CookieJar<'_>) -> Template { let username = cookies .get("username") ...
Lmouden Yousef's user avatar
-4 votes
1 answer
45 views

liam@my-pc:~$ avm install 0.30.0 --force Updating git repository `https://github.com/coral-xyz/anchor` warning: skipping duplicate package `swap` found at `/home/liam/.cargo/git/checkouts/...
Liam lin's user avatar
  • 487
1 vote
0 answers
70 views

I am have a wgpu::Buffer. I am trying to create input to a CoreML from this buffer. let hal_buffer = unsafe { buffer.as_hal::<wgpu::hal::metal::Api>() }; let Some(hal_buffer) = ...
CeNiEi's user avatar
  • 117
Advice
0 votes
2 replies
76 views

Take this code: pub struct Complex<T: SimdElement>(Simd<T, 2>) where Simd<T, 2>: StdFloat; How would I express that I want the inner value to be of the same type as the trait bound? ...
theKMan747's user avatar
4 votes
1 answer
105 views

I have this code using clap: #[derive(Parser, Debug)] #[command(version = "1.0.0", about, long_about = "Long About")] pub struct Args { #[command(subcommand)] commands: ...
Jade's user avatar
  • 824
3 votes
1 answer
67 views

The Rust compiler gives me a lifetime error with the following code (which is a minimal working example of some real code): pub trait TElement: Copy { // Details irrelevant } pub trait TSet<'a,...
KloppyToppy's user avatar
Best practices
0 votes
0 replies
47 views

I'm currently working on an app that stores secrets in an encrypted vault, and the key is derived from a user password. How can I securely prompt the user for their password? Is the IPC with invoke ...
terry's user avatar
  • 191
0 votes
1 answer
62 views

I'm going through Build your own shell, and I've got to the task of implementing command completion. A note suggests: We recommend using a library like readline for your implementation. Most modern ...
Enlico's user avatar
  • 30.3k
0 votes
1 answer
78 views

I have a vector of vectors a : Vec<Vec<usize> in Rust. The inner vectors Vec<usize> do not have the same size. How can I apply a function in parallel to every usize element inside a Vec&...
Uwe.Schneider's user avatar
-1 votes
0 answers
37 views

I have error on line 87: missing lifetime specifier expected named lifetime parameterrustcClick for full compiler diagnostic main.rs(87, 11): consider introducing a named lifetime parameter: `<'a&...
patron 1's user avatar
1 vote
0 answers
59 views

I have been trying to implement a simple drag and drop application in Gtk 4 Rust but I am unable to implement a working version. I can see connect_accept getting triggered, but no matter the result, ...
Margus Laak's user avatar
2 votes
3 answers
115 views

I am writing a scripting language in rust, and I'm pretty new to the language. When I compile source into byte code I move the compiled symbols (Chunk) out of the function. I am also lazy and don't ...
NongusStudios's user avatar
0 votes
0 answers
83 views

I'm using jsonref crate which internally uses rustls crate. When compiling rustls crate it fails in QNX platform, but builds successfully in Linux platform. Below is the error message Error 2025-11-...
Harry's user avatar
  • 4,198
3 votes
0 answers
79 views

I am trying to develop a linear algebra library in rust. So, as part of it I am writing code that iterates through a n-dimensional array and returns mutable references. It's like writing a view for a ...
SpatialFuel's user avatar
Best practices
3 votes
9 replies
141 views

I want to write T::associated_function(..) but sometimes T is too verbose to write, like a long tuple. Is there any way to avoid writing the full T? pub trait Param { fn encode_type(out: &mut ...
mq7's user avatar
  • 1,329
1 vote
1 answer
101 views

I have a build.rs file in my project which contains code of library search paths and library linking. However, if I specify library search paths that doesn't exist in build.rs, it doesn't throw any ...
Harry's user avatar
  • 4,198
5 votes
2 answers
143 views

This is a pattern I want to be able to use in my code to have global variables that contain non-static references. Is it memory safe? If not, how can I make it so? use std::cell::Cell; pub struct ...
Wesley Jones's user avatar
1 vote
0 answers
54 views

I want to load assets from a custom zip-like format, or even GoldSrc WAD3 files. My initial attempt was to use a custom AssetLoader, but I'm not feeling comfortable having to load the entire file's ...
Sigma Octantis's user avatar
2 votes
0 answers
159 views

I just started using neovim. I could get the lua language server to work but not the rust language server (rust-analyzer). When I open a rust file like hello.rs I get the error LSP [rust_analyzer] ...
edamondo's user avatar
  • 189
-3 votes
1 answer
85 views

This is a follow up of my previous post. As suggested, I tried using jsonref crate to de-reference references present in a JSON file. Unfortunately, I'm not getting de-referenced output. main.rs use ...
Harry's user avatar
  • 4,198
1 vote
1 answer
134 views

Let's say I've got a struct that contains a pinned pointer to a boxed T and is Drop: struct S<T> { t: Pin<Box<T>>, } impl<T> Drop for S<T> { // ... } How do I ...
jacobsa's user avatar
  • 7,895
0 votes
0 answers
84 views

I am trying to write a Rust program which generates random FX data and sends it to a Kafka topic. The code I have written so far is quite short. It does not currently compile. use rdkafka; use rand; ...
user2138149's user avatar
  • 18.7k
1 vote
1 answer
74 views

Rust newbie here. The following code throws a compiler error: #![feature(portable_simd)] use std::simd::Simd; use std::simd::SimdElement; fn test_mul<T: SimdElement, const N: usize>(x: [T; N]) ...
user1924406's user avatar
Best practices
0 votes
1 replies
77 views

tl;dr how do I get my project's build profile at build-time so I can branch on it? I have a custom profile for my rust project called myprofile. My Cargo.toml has [profile.myprofile] I build the ...
JamesThomasMoon's user avatar
1 vote
1 answer
101 views

I'm facing an AlignmentMismatch error while trying to cast a Vec<u8> to Vec<T>, where T is a struct that uses repr(C) and Pod + Zeroable. I've also tried the slice road &[u8] -> &...
Sigma Octantis's user avatar
5 votes
1 answer
147 views

struct TestStruct { } trait TestTrait { } impl TestTrait for TestStruct { } struct ResultStruct { } trait ResultTrait { fn make_struct(&self, str: &String) -> impl TestTrait; fn ...
Aaa's user avatar
  • 964
3 votes
1 answer
95 views

I'm trying to work through Rust and using serde_yml as opposed to serde_yaml which has caused me much great confusion, and can't seem to find examples for parsing yaml from a file. I've been running ...
Ender's user avatar
  • 1,922

1
2 3 4 5
879