43,829 questions
0
votes
0
answers
22
views
How to Create a File Tree in GTK-RS/Relm4?
I've been struggling with this for a while, and I've almost got it- but not quite. This is what I have so far:
pub fn load_folder_view(state: &mut State) {
let path = state.current_folder_path....
-3
votes
0
answers
41
views
Rust Sea-Orm get Model from ActiveModel::insert [closed]
I'm trying to write backend using rust, sea-orm and axum. Can someone explain error described next.
pub async fn register(
&self,
register_request: RegisterRequest,
) -> ...
0
votes
0
answers
49
views
Why does mouse look feel jittery in winit + wgpu despite smooth frame rendering?
Code
In the event loop, this arm handles mouse motion with the MouseMotion device event:
Event::DeviceEvent {
event: DeviceEvent::MouseMotion { delta: (dx, dy) },
..
...
0
votes
1
answer
48
views
How to execute async code for thread-locals in a non-threaded environment?
I need to execute an async function for a thread local. The minimal example:
use std::cell::RefCell;
thread_local! {
static REQUESTS_CHECKER: RefCell<()> = RefCell::new(());
}
async fn a() ...
2
votes
1
answer
47
views
Can a channel's Drop omit Acquire ordering, as in the Rust Atomics and Locks book?
In Rust Atomics and Locks chapter 5 (available online for free), this example implementation of a one-time channel is presented:
pub struct Channel<T> {
pub message: UnsafeCell<...
3
votes
1
answer
62
views
Do lifetime parameters have any effect on memory layout?
Is there any guarantee in Rust that lifetime parameters won't change the layout of a type? For example, is the following guaranteed to be okay as long as we ensure that the result doesn't outlive 'a?
/...
0
votes
0
answers
25
views
What does a lifetime bound mean for a non-reference parameter? [duplicate]
I'm trying to understand the 'static lifetime bound on this code:
impl DynFuture {
/// Creates a new `DynFuture` from a Rust `Future`.
pub fn from_future(future: impl Future<Output = ()> ...
-3
votes
1
answer
61
views
I apparently hit a Rust bug, what to do?
I apparently hit a Rust bug. The minimal example:
use std::cell::RefCell;
thread_local! {
static REQUESTS_CHECKER: RefCell<()> = RefCell::new(());
}
async fn a() {}
async fn b() {
...
-6
votes
0
answers
32
views
How to start building a custom graphics library in Rust (like a mini wgpu or nannou)? [closed]
I'm learning Rust and I want to create my own graphics library — not just use existing ones.
I understand Rust basics (ownership, structs, traits, modules) and I’ve read parts of The Rust Book.
Now I ...
-2
votes
0
answers
27
views
Idiomatic way to "stream" rows to a parquet file using Rust Polars [closed]
I'm struggling a bit with an idiomatic way to do this. Let's say I have a struct Foo{id: u32, timestamp: std::time::Instant, data: String}, and I have an iterator yielding Foos (in my case from the ...
19
votes
1
answer
585
views
Is (de)serializing `usize` with Serde platform-dependent?
For example, if I serialize usize::MAX on a 64-bit system and then deserialize it on a 32-bit system, what would happen? An overflow error, be truncated to a u32 and cause misaligned read for the ...
1
vote
1
answer
82
views
How can I control whether a u64 is encoded as varint or standard in bincode?
I'm using the bincode crate for de/serialization of my structs. The structs contain fields various signed and unsigned integer types. For some of these types, using the standard varint encoding is ...
0
votes
0
answers
56
views
How to get struct fn to accept different data types depending on a struct id [closed]
struct Struct0 {
a: usize,
b: usize,
c: Vec<f64>
}
impl Struct0 {
math functions here
}
struct Struct1 {
a:usize,
b:usize,
c:Struct,
d:Vec<f64>,
}
when i ...
0
votes
1
answer
62
views
Incorrect path using in Swagger Ui with utoipa axum
Writing an HTTP API in Rust using axum with utoipa for documentation.
My problem is that even tho the actual program is working fine, Swagger UI does the curl requests to the wrong endpoints.
Router ...
-2
votes
0
answers
21
views
Unable to log in to Guest VM shell in Teaclave TrustZone SDK Docker dev environment [closed]
I'm trying to run the "Hello World" Rust example for the Teaclave TrustZone SDK. I'm using the Development Docker Image as described in the official guide: Teaclave TrustZone SDK - Emulate ...