Compare commits
No commits in common. "27287dead071a6eb641b13f9c1185ea9ddc3489e" and "c0f5a1d89c8e18505d054dff80be20473675fdb4" have entirely different histories.
27287dead0
...
c0f5a1d89c
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
fn main() {
|
|
||||||
println!("Hello, World!");
|
|
||||||
}
|
|
43
README.org
43
README.org
@ -4,10 +4,7 @@
|
|||||||
#+startup: indent
|
#+startup: indent
|
||||||
|
|
||||||
#+link: ch01 https://rust-book.cs.brown.edu/ch01-00-getting-started.html
|
#+link: ch01 https://rust-book.cs.brown.edu/ch01-00-getting-started.html
|
||||||
|
* Chapter 01: Installation
|
||||||
* Getting Started
|
|
||||||
|
|
||||||
** Chapter 01: Installation
|
|
||||||
Recommendation is to use ~rustup~ using the command:
|
Recommendation is to use ~rustup~ using the command:
|
||||||
#+name: install rustup
|
#+name: install rustup
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
@ -22,7 +19,7 @@ To confirm it's installed:
|
|||||||
|
|
||||||
#+RESULTS: confirm rustup installed
|
#+RESULTS: confirm rustup installed
|
||||||
: rustup 1.26.0 (5af9b9484 2023-04-05)
|
: rustup 1.26.0 (5af9b9484 2023-04-05)
|
||||||
*** Update
|
** Update
|
||||||
To update ~rustup~ and please do regularly
|
To update ~rustup~ and please do regularly
|
||||||
#+name: update rustup
|
#+name: update rustup
|
||||||
#+begin_src shell :results output
|
#+begin_src shell :results output
|
||||||
@ -33,44 +30,10 @@ To update ~rustup~ and please do regularly
|
|||||||
:
|
:
|
||||||
: stable-x86_64-unknown-linux-gnu unchanged - rustc 1.76.0 (07dca489a 2024-02-04)
|
: stable-x86_64-unknown-linux-gnu unchanged - rustc 1.76.0 (07dca489a 2024-02-04)
|
||||||
:
|
:
|
||||||
*** Documentation
|
** Documentation
|
||||||
~rustup~ comes with documentation, just type
|
~rustup~ comes with documentation, just type
|
||||||
#+begin_src shell
|
#+begin_src shell
|
||||||
rustup doc
|
rustup doc
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
and the browser will open a page with links toward lots of docs.
|
and the browser will open a page with links toward lots of docs.
|
||||||
|
|
||||||
** Chapter 02: Hello, World!
|
|
||||||
Basically done in 3 steps:
|
|
||||||
- Edit the rs file
|
|
||||||
- Compile using ~rustc~
|
|
||||||
- Call the executable
|
|
||||||
|
|
||||||
|
|
||||||
Work folder is =Projects/01_HelloWorld=, where we create the file =main.rs=
|
|
||||||
#+name: hello_world main.rs
|
|
||||||
#+begin_src rust
|
|
||||||
fn main() {
|
|
||||||
println!("Hello, World!");
|
|
||||||
}
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
To execute this program:
|
|
||||||
#+name: 0102 call main
|
|
||||||
#+begin_src shell :results output
|
|
||||||
cd Projects/01_HelloWorld/
|
|
||||||
rustc main.rs
|
|
||||||
./main
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+RESULTS: 0102 call main
|
|
||||||
: Hello, World!
|
|
||||||
|
|
||||||
The program wordes, I'm now done.
|
|
||||||
|
|
||||||
*** Note
|
|
||||||
All rust program starts by calling the function ~main~.
|
|
||||||
Functions with ~!~ appended to their name, like ~println!~, are macros.
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user