Working through rustbyexample
This commit is contained in:
parent
23574cafae
commit
fc7a5ee342
1
rustbyexample/.gitignore
vendored
Normal file
1
rustbyexample/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
target/
|
4
rustbyexample/01/Cargo.lock
generated
Normal file
4
rustbyexample/01/Cargo.lock
generated
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[root]
|
||||||
|
name = "01"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
6
rustbyexample/01/Cargo.toml
Normal file
6
rustbyexample/01/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[package]
|
||||||
|
name = "01"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Dan Buch <daniel.buch@gmail.com>"]
|
||||||
|
|
||||||
|
[dependencies]
|
23
rustbyexample/01/src/main.rs
Normal file
23
rustbyexample/01/src/main.rs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
fn main() {
|
||||||
|
println!("{} days", 31);
|
||||||
|
|
||||||
|
println!("{0}, this is {1}. {1}, this is {0}", "Alice", "Bob");
|
||||||
|
|
||||||
|
println!("{subject} {verb} {object}",
|
||||||
|
object="the lazy dog",
|
||||||
|
subject="the quick brown fox",
|
||||||
|
verb="jumps over");
|
||||||
|
|
||||||
|
println!("{} of {:b} people know binary, the other half don't", 1, 2);
|
||||||
|
|
||||||
|
println!("{number:>width$}", number=1, width=6);
|
||||||
|
|
||||||
|
println!("{number:0>width$}", number=1, width=6);
|
||||||
|
|
||||||
|
println!("My name is {0}, {1} {0}", "Bond", "James");
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
struct Structure(i32);
|
||||||
|
|
||||||
|
// println!("This struct `{}` won't print...", Structure(3));
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user