learning-rust / learning-rust.github.io Goto Github PK
View Code? Open in Web Editor NEWRust Programming Language Tutorials for Everyone!
Home Page: https://learning-rust.github.io
License: MIT License
Rust Programming Language Tutorials for Everyone!
Home Page: https://learning-rust.github.io
License: MIT License
Hey, great resource you have here! But there's some weird stuff done in the CSS that makes things go absolutely goofy on ultrawide monitors.
It looks like the developer tested the styles for ultrawide monitors like this.
And that seems fine, but when that's actually on my monitor, it looks like this.
The font size that is in my URL bar, or in the dev tools, or on the tab are perfectly optimal for reading.
I actually have to shrink the screen to make it readable, like this.
It looks like the problem is this file. Removing that and the reference here would fix the problem. I really think that users can be trusted to adjust their scaling to what's comfortable to them.
Please
Hello,
Thanks everyone for this amazing resource for learning rust. I have a question regarding a section in lifetime section.
Lifetime annotations are checked at compile-time. Compiler checks when a data is used for the first and the last times. According to that, Rust manages memory in run time. This is the major reason for slower compilation times in Rust.
was this suppose to say Rust manages memory at compile time ...
and not ...in run time...
based on the context of the statement?
This is coming from hexo which still depends on swig. Hexo team is planning to move away from it hexojs/hexo#1593
Referencing Java interfaces as a comparison to traits then right after making a "but" traits can have default method impls may cause some confusion for Java developers https://github.com/learning-rust/site/blob/master/source/docs/b5.impls_and_traits.md
The reason being that Java interfaces can also have default method impls https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html.
I'm suggesting the change because I'm offering this content up to my company of mostly Java/Scala developers as onboarding material for learning rust.
I guess that in the binding of variable d
in arrays you wanted to use =
instead of :
. As of Rust 1.23.0
this is an error.
I like how it is well polished. However I wish there it was more interactive, like CodeCadmey and Khan Academy.
Take a look at how it explains how to do programming
https://www.khanacademy.org/computing/computer-programming/programming/drawing-basics/pt/drawing-more-shapes-with-code
In this link, it is an interactive video, meaning that you can change code inside the video so you can experiment.
https://www.khanacademy.org/computing/computer-programming/programming/drawing-basics/pc/challenge-simple-snowman
In this link I like how they give you an interactive exercise, and I wish to see that in Rust as well.
Hi, I'm new to Rust and trying the sample in this doc
https://learning-rust.github.io/docs/borrowing/
The code
fn main() {
let mut a = vec![1, 2, 3];
let b = &mut a; // &mut borrow of `a` starts here
// some code
b[1] = 123;
println!("{:?}", a); // trying to access `a` as a shared borrow, so giving an error
} // &mut borrow of `a` ends here
It seems to compile and run fine without any error on my machine
ubt :: testbin ‹master› % rustc --version 1 ↵
rustc 1.78.0 (9b00956e5 2024-04-29)
ubt :: testbin ‹master› % cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
Running `target/debug/testbin`
[1, 123, 3]
Is it intended, or something has changed from the language itself.
Hi,
I am a developer who is learning the Rust recently. I've read some books about Rust, and I feel this site is a good tool. I noticed that there is a language switcher at the top of the page, but English is the only option, for now.
I want to add a Chinese version of these docs and I need to know how can I do that :)
I'm excited about translating the documents into pt/br. This project helped me a lot on my journey to learn about rust. How can I do this. Is it just opening a PR with the translated documents?
There is some responsive issue when the window is larger than 2560px.
If you don't have a wide screen, you can debug that with the "simulator mode" at 50% scale.
In many situations, it is useful to refer to chapters by number. eg. Chapter 3.1
I dont recommend checking yourself but the areweaudioyet link within the "why rust?" page shows something that is in fact, not audio related
It's just an opinion but, I think, the formula for showing multiple files in one code block makes it really confusing to read. It would be much better for multiple files to use multiple code blocks.
This is what we have now.
// 01. greetings/Cargo.toml to mark as a workspace and to add members [workspace] members = [ "lib", "examples/hello" ] // 02.1 greetings/lib/Cargo.toml to change the package name to greetings [package] name = "greetings" version = "0.1.0" authors = ["Dumindu Madunuwan"] [dependencies]
It would be better like this.
greetings/Cargo.toml to mark as a workspace and to add members
[workspace] members = [ "lib", "examples/hello" ]
greetings/lib/Cargo.toml to change the package name to greetings
[package] name = "greetings" version = "0.1.0" authors = ["Dumindu Madunuwan"] [dependencies]
This page is the first or second google result for "rust unwrap_or_else example": https://learning-rust.github.io/docs/e4.unwrap_and_expect.html#unwrap-or-unwrap-or-default-and-unwrap-or-else
It takes longer than should be necessary to look at this pile of asserts and 1-2 character variable names and figure out the meaning. Having real examples would help a lot. The closure definitions in the unwrap_or_else example are particularly unhelpful as they don't include passing parameters to the closure, they're so short it makes it hard to think of them as anonymous functions, and they also aren't written in-line which is how they'll often be used.
Something like this is considerably more useful: https://gist.github.com/csknk/68b3d87bc76ce8c3431145fc0cc2fd3d
I'm not sure to understand exactly what this means :
Simply this is the data type to cover all unsigned integer types but memory allocates according to the
size of a pointer. Min and max values are similar to u64.
I guess these types are similar to C's [s]size_t
used for storing objects size (usually 32bits on 32bits platform and 64bits on 64bits platforms).
Hi, I have no issues as of the moment but I just wanted to say thank you for making this. It's a really valuable resource. Maybe in the future, I'll have something to contribute. Anyway I just wanted to know that what you made is really valuable. Thank you.
Just wanted to say a big thank you for creating this site.
There is a confusing expression in the lower half of the section about vector, "No of elements". What does the sentence mean? "Num of the elements" ?
Added on rust 1.2.6, u128
is a new primitve data type which is currently not present in the site.
In the guides,
You mistakenly suggest throughout the pages that things should be named using CamelCase notation.
But it is wrongly represented, the correct names should be:
camelCase: lower case for first word, Capital for initial of following words.
PascalCase: Initial for all words should be uppercase.
snake_case: compound word separated by underscore
Despite that, the docs are really good, thanks to put it together.
Rust beginner here, coming from Python.
I'm noticing some parts of the text that either have some language errors or could do with clarification. Since my main intention today is to learn some Rust, I'm not creating PRs to fix them all now, but instead gathering them here and then either I or maybe someone else can go through them later.
Updating as I go:
Basics -> Cargo: "But mainly it uses for," is an odd rather empty sentence. The following bullet points don't really fit in with the idea of a package manager either. I'm familiar with package managers that let me download and install software others have written (i.e. matplotlib). This section appears to be concerned with creating projects to share with others? Maybe that should be moved to after the reader has downloaded some packages?
Basics -> Comments: "Never use block comments" does not teach me why not. What is the difference between module and crate level documentation? Maybe move the latter discussion to later rather than confuse now?
I'm confused
In section "i8, i16, i32, i64, i128":
Min and max values are based on IEEE standard for Binary Floating-Point Arithmetic.
In section "u8, u16, u32, u64, u128":
Same as signed numbers, min and max values are based on IEEE standard for Binary Floating-Point Arithmetic.
Does "IEEE standard for Binary Floating-Point Arithmetic" means IEEE 754? I think it doesn't specify integer numbers. It even says in section "2. Definitions, abbreviations, and acronyms ":
2.1.32 integer format: A format not defined in this standard that represents a subset of the integers and perhaps additional values representing infinities, NaNs, or negative zeros.
In the very first example in the Vectors chapter
let mut a = Vec::new(); //1.With new() keyword
let mut b = vec![]; //2.Using the vec! macro
when I compile just these statements I get an error saying
error[E0282]: type annotations needed
--> a.rs:19:15
|
19 | let mut bv = vec![]; //2.Using the vec! macro
| ------ ^^^^^^ cannot infer type for `T`
| |
| consider giving `bv` a type
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Shouldn't this be documented in the guide?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.