I'm having a problem with Rust that I strongly suspect has do with a disconnect between Cargo and VS Code. I build my Cargo project with cargo new project I ed
When I try to declare a struct inside of another struct: struct Test { struct Foo {} } The compiler complains: error: expected identifier, found keywor
I want to use a HashMap<f64, f64>, for saving the distances of a point with known x and key y to another point. f64 as value shouldn't matter here, the fo
I want to combine two reference vectors and convert them into a vector of values without consuming an iterator. Situation: Generate vectors by iterating over sp
The documentation for reqwest v0.9.18 shows the following example of posting a file: let file = fs::File::open("from_a_file.txt")?; let client = reqwest::Clien
When iterating over arguments (for example) thats the most straightforward way to skip the first N elements? eg: use std::env; fn main() { for arg in env
Given that I know ParentId and ChildId, how would I find the UserId if the hashmap is: HashMap<ParentId, HashMap<ChildId, HashMap<UserId, Foobar>>
A small Iron project calls a Command in some route and returns a Response. Here is the relevant code of the route handler function: fn convert(req: &mut Re
I'd like to capitalize the first letter of a &str. It's a simple problem and I hope for a simple solution. Intuition tells me to do something like this: le
I come from a Java background and I might have something like enum Direction { NORTH, SOUTH, EAST, WEST} and I could do something with each of the values in tur
I'll get error when compiled: 'returns value referencing data owned by the current function' here's the code: fn return_static_str(a: &'st
I am working on a Rust program where I got stuck on a problem that can be reduced to following case: struct Pair<L, R> { left: L, right: R, } // Retu
var fruits = ["Banana", "Orange", "Apple", "Mango"]; var index = fruits.indexOf("Apple"); let fruits = ["Banana", "Orange", "Apple", "Mango"]; let index = fru
I have an 8k buffer of bytes. The data in the first part of the buffer is highly structured, with a set of variables of size u32 and u16. The data in the later
I have a ubuntu machine with multiple users some of whom have and have not root privileges. Above that I have a limited storage for the same machine. I really d
I have a ubuntu machine with multiple users some of whom have and have not root privileges. Above that I have a limited storage for the same machine. I really d
I'm trying to convert the following SQL query into corresponding Rust Diesel code: SELECT COUNT(*) FROM BookStore WHERE BookName IN ('Lord of the Rings', 'Hobbi
I have an api service that has 2 layer: api and repository. The api layer is where the request handling and business logic defined, while repository is a databa
My goal is to have it so when the executable is just double clicked no console spawns but also have it able to print to the console when the user launches it fr
I'm tring to make a native gui app using egui. After some time got the hello_world example to compile.Heres the code: use eframe::{epi, egui}; struct MyEguiApp