Top "Rust" questions

Rust is a systems programming language without a garbage collector focused on three goals: safety, speed, and concurrency.

What is the correct way to return an Iterator (or any other trait)?

The following Rust code compiles and runs without any issues. fn main() { let text = "abc"; println!("{}", text.split(' ').…

rust
Is there any way to return a reference to a variable created in a function?

I want to write a program that will write a file in 2 steps. It is likely that the file may …

reference rust lifetime
How do I convert a C string into a Rust string and back via FFI?

I'm trying to get a C string returned by a C library and convert it to a Rust string via …

c ffi rust
How to specify const array in global scope in Rust?

When I tried to add a const array in the global scope using this code: static NUMBERS: [i32] = [1, 2, 3, 4, 5]; I got …

arrays static literals rust
How to launch a Rust application from Visual Studio Code?

I have installed the Visual Studio Code extensions for Rust: I want to run my project and I don't understand …

rust visual-studio-code rust-cargo rls
How to create a Rust struct with string members?

I want the members to be owned by the struct. Sorry for the simple question, but I wasn't able to …

string rust
No default toolchain configured after installing rustup

I installed Rust using rustup, but when I try to enter a Rust command like cargo or rustc in my …

rust
How to use a local unpublished crate?

I've made a library: cargo new my_lib and I want to use that library in a different program: cargo …

rust multifile rust-crates
How to compare enum without pattern matching

I want to apply filter on an iterator and I came up with this one and it works, but it's …

enums pattern-matching rust
Converting a str to a &[u8]

This seems trivial, but I cannot find a way to do it. For example, fn f(s: &[u8]) {} pub …

string rust slice