book
book copied to clipboard
The Rust Programming Language
- I have searched open and closed issues and pull requests for duplicates, using these search terms: - const - trait const - I have checked the latest `main` branch...
- I have searched open and closed issues and pull requests for duplicates, using these search terms: - field is never read - dead_code - I have checked the latest...
In explanation of for loop, advantage of for loop is mentioned that we don't need to remember to change code else where if we change number of values in the...
> When we use trait objects, Rust must use dynamic dispatch. The compiler doesn’t know all the types that might be used with the code that’s using trait objects, so...
Just added another way to fix the last code sample from https://doc.rust-lang.org/book/ch03-03-how-functions-work.html ``` fn main() { let x = plus_one(5); println!("The value of x is: {x}"); } fn plus_one(x: i32)...
- [x] I have checked the latest `main` branch to see if this has already been fixed - [x] I have searched existing issues and pull requests for duplicates URL...
Fix some terms that could cause misunderstanding. - `extern` is a keyword, not a function. - Listing 19-8 shows calling of external function `abs`, not `extern`.
As per experimentation shows, `match` arms exhaustivness is checked even when arms use _match guard_. This simple sample ```rust pub fn test() { match Some(5) { Some(50) => println!("Got it"),...
- ~`Vec` denotes generic type with unconstrained `T` type parameter. As this chapter kindly describes Rust generics cannot hold 2 or more struct kinds. `Vec` is sufficient and proper at...
‣ irrefutable pattern receives warning, refutable error, when used unexpectedly