EN VI
Posts (0)
Questions (17)
2024-03-16 01:30:06
Rust can split borrows among fields. In do_mut_stuff_works, you start with a mutable borrow of self. When you take self.bar.iter(), that borrow is split: self.bar is immutably borrowed for the duratio...
Tags: rust borrow-checker
2024-03-16 11:30:04
A Box is a non-nullable pointer in Rust. An Option is either a None or a Some(T), but Option (as noted in the related answers you link) always allocates enough space for T. So in your example, there's...
Tags: c++ arrays rust
2024-03-16 16:00:05
Your original regex seems to work fine if you make the capturing group lazy with a ?: ^\s*(.*?)\s*$ See here: https://regex101.com/r/bTRoG9/2
Tags: regex rust
2024-03-16 20:00:07
When you do Node::new(some(a), 2), then a is no longer accessible, it's ownership now belongs to b. That's why, when you later do a.id it says value borrowed here after move, you moved the ownership t...
Tags: rust ownership
2024-03-17 02:00:04
This is a case of a somewhat less-known detail of Rust's inference: if there are two possible method candidates, and one of them comes from a trait bound of the function (and the other does not), Rust...
Tags: rust trait-bounds
2024-03-17 17:00:07
I would move some stuff to other functions. impl RegionKind { // you may want to make this a method on `Region` instead fn subregion(&self) -> Option { if let RegionKind::Split { subre...
2024-03-17 18:00:08
Contrary to the documentation (ClearType::Purge - "All plus history"), Purge clears only history, not the screen. It also sends ANSI escape ESC[3J, which means "erase history", not "clear screen" (alt...
Tags: rust tui crossterm

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login