My console application needs to clear the screen. How do I truly clear the screen, like the reset command in Linux? I tried using methods I found on Google, li
When implementing complex calculations, I found that readability suffered a lot. For example, this formula is absolutely unreadable when translated to code (I c
Currently, I use VSCode as my IDE when programming Rust. I use the rust-analyzer VSCode extension, since it seems to be the best one out there for Rust (as of 2
There are many ways to detect the target OS, e.g. #[cfg(windows)], #[cfg(unix)], std::env::consts::OS. For cross-compilation, how can we detect the OS that our
Expected Behavior: Clicking "Run doctest" in vscode should execute one test from doctest snippets. Terminal output SHOULD say ("1 passed;" or "1 failed;"), and
enter image description here **I create rust project by "cargo new [name]" and install rust-analyzer in vsCode.But when I open the project by vscode,there's an
What does the asterisk / star (*) at the end of a cargo tree output represent? How and where is it used?
my docker builds started failing today and I can't seem to figure out exactly how to fix it. Compiling locally is still working. When I try to create a containe
I ran anchor test --skip-deploy and all it should do is initialise my program, but all I get is this error, that I cannot resolve. I checked the tsconfig.json s
I'm getting started with Rust. I want to have a struct that contains (among other things) a string: #[derive(Clone, Debug)] struct Foo { string_field: &
I'm reading the documentation for File: //.. let mut file = File::create("foo.txt")?; //.. What is the ? in this line? I do not recall seeing it in the Rust
I want trait implementations in Rust to be able to return arbitrary iterators (of specific item type) that may reference the original object with a lifetime 'a
I often want to compile in release mode with debug = true so that I can read the generated assembly a bit easier. I am currently doing this: [profile.release]
Is there a way to extract the number of elements in an enum? Simple example (with imaginary number_of_elements method): enum FooBar { A = 0, B, C, }; println
MCVE (simplified from real code where I may return a raw vec.iter(), or a vec.iter().filter() based on some conditions): let input = vec![1,2,3]; let dyn_iter:
I’m just starting a Rust project and already it takes ~7.6s to build what I’d consider a simple binary. I’m using async/await a lot and comme
I am implementing gRPC client and server using Tonic. I have two modules each module depending on another module proto file. I am facing an issue when I try to
I am setting some breakpoints in some async threaded code and I can't seem to figure out how to tell visual studio code to catch any threads in this code path.
My program, when started up with the system, is unable to access a networked location: fn main() { ensure_network("\\\\SERVER\\".to_string()); } fn ensure_
I'm trying to invert a HashMap<String, MyEnum> in Rust, and getting an error: Rust Playground instance Code: use std::collections::HashMap; // Directive