Ask Question
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].
28,895 questions 2- Bountied 2
- Unanswered
- Frequent
- Score
- Unanswered (my tags)
Debugging Stalled Runtime in Tokio and Rust
How do you debug code that seems to stall for no reason after running a large number of tasks? More Detail My code runs ~4k tasks, each: Makes 1-100 web requests. Parses a lot of JSON. Returns an ... rust rust-tokio- 413
Rust + Tokio: Process First Task to Complete
In Tokio, how do you wait for the first task in a list of tasks to complete? The size of the list is unknown. More specifically: You have a list of tasks. Wait for the first to complete. Run some ... rust rust-tokio- 413
Best way to make async function return Vec without allocation
I need an async function return multiple items without using a future streams (i.e. futures::Stream). The most obvious way of doing that is to return Vec<T>. But I would like to avoid heap ... rust async-await- 1,252
How to use a crate with a custom type in a rust-ink smart contract?
I want to use a byte buffer structure in a smart contract of mine. So I want to use the bytes crate. After adding it to my Cargo.toml file I wrote this small contract to test it out. #![cfg_attr(not(... rust crate rust-ink- 1
stdweb::web::html_element::CanvasElement from document().query_selector() in Rust
I am building a Yew webapp in Rust, and attempting to get a CanvasRenderingContext2d from a CSS selector. The issue I am having is how to convert a stdweb::web::Element into a stdweb::web::... canvas rust yew- 6,804
Is there an alternative expression for match in Rust?
I know that when handling errors using Result and Option, it can be expressed more concisely by using unwrap_or_else, unwrap_or_default, etc. instead of match. The following is an example of ... rust- 59
How can implement traits for packages through rust workspace?
I created a workspace called extend_triats as lib. [dependencies] extend_triats = { path = "./extend_triats" } nav_bar = { path = "./nav_bar" } tree_list = { path = "./... rust workspace cargo- 782
Mapping errors from Command::new("/bin/bash") arguments
I am executing a bash command, for which I would like to catch an error when the move argument fails. Since there is one more command after move, my goal is to capture specifically whether the move ... rust- 1
Rust File Tree move occurs because `subtree` has type `trees::Tree<PathBuf>`, which does not implement the `Copy` trait
i am trying to make a simple tauri Program where i have a Filetree of all Files and sub files of a chosen directory. I have not got many experience in Rust and ran into a problem with Ownerships. Code ... rust ownership filetree tauri- 1
Cannot run my Snap package (built from Rust App)
This is how my snapcraft.yaml looks like (at the root of my Rust project): name: keval-snap base: core20 version: '0.1' summary: Single-line elevator pitch for your amazing snap # 79 char long ... rust snapcraft- 2,538
Copy slice into its own array
I want to copy the values at one slice of an array into another slice. The obvious way (using iteration) is: for i in 0..10 { self.ram[i] = self.ram[20 + i]; } However, that seems rather ... arrays rust slice memcpy borrow-checker- 536
Saving rust_decimal to mongodb
I'm trying to save a rust_decimal::Decimal object in MongoDB. My first attempt was generally: // self.db is of type mongodb::sync::Database decimal = Decimal::new(1, 20); let order = doc! {"... mongodb rust decimal bson- 11
How to query a specific set of attributes from dynamoDB using rust language?
I am new to Rust and this question may come off as silly. I am trying to develop a lambda that reads a single item from dynamoDB given a key. The returned item needs to be shared back as result to the ... rust- 23
Is it possible to borrow different parts of self with different mutability statically?
I am designing some struct with a prepare-commit pattern in rust, which mostly looks like this after simplified: struct Data { a: usize, } struct Adder<'a> { data: &'a mut Data, ... rust- 193
Unexpected segfault when working with raw pointers
Initially I wrote a Heap implementation in Rust, but I was getting strange segfaults, so I narrowed down the code to this example, which reproduces the behavior. use core::fmt::Debug; pub struct Node&... rust segmentation-fault raw-pointer- 49
15 30 50 per page12345…1927 Next