Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.
0 votes
1 answer
9 views

Type gymnastics of heterogeneously-typed lists in Rust

I'm designing a pass system inspired by frunk. Background This is a little introduction of the Selector in frunk. If you are familiar with it, just skip this section. Roughly speaking, frunk uses a ...
Evian's user avatar
  • 1,225
0 votes
0 answers
14 views

Rapier does not move RigidBody in expected direction

I have a RigidBody with the components (Velocity, Transform). When changing the rotation with transform.rotation = …, the “forward” direction of the body remains the same when adding velocity. How ...
Clover Johnson's user avatar
0 votes
0 answers
58 views

Is vector reallocation bad? (Arena tree implementation) [closed]

Let's say I have a tree, implemented with a Vec-backed arena and type NodeID = Option<u32> as references to locations in the arena. This tree can grow to an arbitrary large size. The naive ...
Mascarpone's user avatar
  • 2,564
1 vote
1 answer
45 views

How to downcast any List or any Option in rust

I want to add properties window with auto properties based on struct fields. I'am downcasting every field, but for Vec<> and Option<> I have to duplicate all code, how can I automatically ...
Kravtsov Hryhorii's user avatar
1 vote
2 answers
112 views

Extract value from nested Box<T>

In my project I have recursive enum that holds various constraints. One of the variants implies that constraint is negated. #[derive(PartialEq, Eq, PartialOrd, Ord, Debug)] enum A { NOT(Box<A&...
Pawel Pabian bbkr's user avatar
0 votes
1 answer
77 views

serini failing to deserialize windows path with "r" "n" or "t" as first letter of directory

I have a structure that I need to write to disk, it keeps track of a number of resources including a folder where stuff is saved. I'm finding that when I deserialize the folder if the path contains ...
Connagh Jacobi's user avatar
-3 votes
0 answers
28 views

The command "cargo build-sbf" is not working for me?

Whenever I run cargo build-sbf I get the following error: error: no such command: `+solana` help: invoke `cargo` through `rustup` to handle `+toolchain` directives When I reinstall solana-cli to ...
Boomboom Turtle's user avatar
0 votes
0 answers
50 views

How can I fix this so my function can be used as an Axum handler? [duplicate]

I'm using Axum 0.8.4 and trying to register a route with a handler that takes both Query and Extension extractors. But I get this trait bound error saying the function doesn't implement Handler<_, ...
Raphael Tunji's user avatar
0 votes
1 answer
78 views

Multithreaded Web Server from the Rust book, but implemented with shared memory instead of message passing

I'm following the Rust Book's chapter 20 to create a multithreaded web server. Everything went pretty smooth, the implementation they describe up until the end of this chapter works as expected. Here'...
smellyshovel's user avatar
0 votes
0 answers
100 views

How do I avoid memory being swapped in Rust?

TLDR: I have a huge array (around 70% of available memory) and I don't want it to be swapped to disk. What's the best way on modern linux to pin a vector in memory so that it doesn't get swapped by ...
Mascarpone's user avatar
  • 2,564
2 votes
0 answers
104 views
+50

Custom hasher is faster for insert and remove, but when done together is slower, when comparing to std::collections::HashMap

I wish to benchmark various hashmaps for the <K,V> pair <u8, BoxedFnMut> where BoxedFnMut. type BoxedFnMut = Box<dyn FnMut() + Send + 'static>; To do this, I am using divan(0.1.21) ...
Naitik Mundra's user avatar
2 votes
1 answer
91 views

Why can the argument of a function implicitly change its type from &&T to &T? [duplicate]

Consider the following example, the test function receives the &str type, but it works when I transfer it &&str, &&&str, &&&&str. What's the rule? I don't think ...
shijun zhao's user avatar
4 votes
1 answer
58 views

Wrapped stream Unpin behaves unintuitively

After half a year of Rust coding, today I am for the first time truly baffled by a compiler error. Here is the condensed version of a library concept I was working on: use futures::{Stream, StreamExt, ...
Niklas B.'s user avatar
  • 95.7k
4 votes
1 answer
46 views

Constrained type is unconstrained?

I've been writing Rust for a several months now, and I've come across this headscratcher: I have the following code: trait MyTrait {} impl MyTrait for String {} impl MyTrait for str {} impl MyTrait ...
lilHar's user avatar
  • 1,875
2 votes
0 answers
49 views

How can I create queries in diesel where the order criterion is supplied by a method?

I am building a backend in Rust and use diesel to access a Postgres database. I want to be able to supply the ordering with its own function. This function should take an Option<String> as ...
Talinx's user avatar
  • 116

15 30 50 per page
1
2 3 4 5
2915