Questions tagged [rust-rustlings]
The rust-rustlings tag has no usage guidance.
rust-rustlings
14
questions
0
votes
2
answers
78
views
How to debug without changing all the function signatures?
I'm learning Rust by reading the book and doing rustlings and watching videos; I think I understand what's happening here, but I don't understand what to do about it.
#[derive(Debug)]
enum Message {
...
0
votes
1
answer
51
views
Variable re assigment causing lifetime issues
I am working through the rustlings exercises and I ran into something i don't fully understand about lifetime. I will simplify the code to just the confusing part.
This function compiles correctly:
fn ...
0
votes
1
answer
68
views
Wrote an Invisible whitespace in VScode, but showed in command line
I was playing with rustlings untile I've reached the exercise primitive_types2.rs.
To print in output Neither alphabetic nor numeric! I've started to mess up with ALT + NUMPAD and I've generated this ...
0
votes
1
answer
50
views
How can I transform a vector of strings in Rust with map and then join the strings with flat_map in one line?
I'm doing the second level of rustlings for the iterator chapter.
I found the following solution for step 3, and now I would like to chain map and flat_map.
// Step 3.
// Apply the `capitalize_first` ...
0
votes
1
answer
146
views
Confused by rustlings hashmaps3.rs [duplicate]
I'm doing the rustlings exercises, and I've arrived at a simple question after doing one of the exercises, but I'm also not sure I'm not doing something else wrong.
Here's the question: is it the case ...
0
votes
1
answer
239
views
Getting auto completion work with rustlings in VSCodium?
I am running VSCodium version 1.85.2, rustc and rust-analyzer 1.76.0, and the rust-analyzer Visual Studio Code extension version 0.3.1839.
The extension is partially working. I get syntax errors, for ...
0
votes
1
answer
79
views
Rustlings move semantics.3 solution does not make sense to me
Trying to learn Rust and got really confused with the solution from the move_semantics3.rs exercise.
Here is the exercise for reference:
// move_semantics3.rs
//
// Make me compile without adding new ...
1
vote
0
answers
341
views
VSCode Debugger won't stop at breakpoints in Rust code
I am learning Rust through the rustlings project, and I cannot get VSCode to stop at my breakpoints no matter what tutorial I follow on Rust debugging. I am currently doing this on Mac OS 12.6.
I ...
0
votes
1
answer
176
views
Rust visibility from child module to outside
I'm learning about Rust, and trying to figure out the visibility rules for modules.
I have the following code:
fn x() -> u8 {
5
}
struct Person {
name: String,
}
mod example {
use ...
1
vote
1
answer
84
views
Rustlig if2 trying to convert 1 to "1" inside the function foo_if_fizz
I'm new to rust and I'm looking for a way to convert 1 to "1" at compile time;
pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" {
"foo&...
2
votes
1
answer
1k
views
Rustlings Quiz2: Why is i of type &usize instead of usize
I am new to Rust and I am attempting the Rustlings quiz2 problem.
Below is the whole code for reference.
// quiz2.rs
// This is a quiz for the following sections:
// - Strings
// - Vecs
// - Move ...
2
votes
2
answers
167
views
Rustlings slice primitives
One of the rustlings exercises on primitive is about slices.
When I tried to solve this exercise I started by using the [start...end] syntax to take a slice into the given array as such
fn ...
1
vote
2
answers
827
views
Method `push_str` returns () instead of String
I'm trying to learn rust via rustlings and I'm encountering this weird error. I understand that it modifies self in place but why does it return a unit () instead of the modified String
impl AppendBar ...
1
vote
1
answer
467
views
rustlings: hashmap3.rs expected `()`, found struct `Team`
I'm learning rust using rustlings. I was trying to implement a solution in a functional way (rustlings only asked for the imperative way). I'm running into the following compiler error and haven't ...