projects
/
rust-101.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
231a88a
)
write something on read_vec
author
Ralf Jung
<post@ralfj.de>
Mon, 8 Jun 2015 12:18:25 +0000
(14:18 +0200)
committer
Ralf Jung
<post@ralfj.de>
Mon, 8 Jun 2015 12:18:25 +0000
(14:18 +0200)
src/main.rs
patch
|
blob
|
history
src/part00.rs
patch
|
blob
|
history
diff --git
a/src/main.rs
b/src/main.rs
index 7bf7dbea29d520bf23d416f34255a88f17681979..4352a505b98ab846be3f3f634eb059c0132616b9 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-10,6
+10,9
@@
// I plan to cover. They may also be helpful as an offline resource, but you're on your
// own then.
// I plan to cover. They may also be helpful as an offline resource, but you're on your
// own then.
+// I will assume basic familiarity with programming, and hence not explain the basic
+// concepts common to most languages. Instead, I will focus on what makes Rust special.
+
// The actual course is in the partXX.rs files. I suggest you get started with
// [the first part](part00.html), or jump directly to where you left off:
// The actual course is in the partXX.rs files. I suggest you get started with
// [the first part](part00.html), or jump directly to where you left off:
diff --git
a/src/part00.rs
b/src/part00.rs
index 73fe8c175b861425484d4e5395c9189c9d209840..b887eb4f25d7f4e7ac1dcebc113f4297c397d662 100644
(file)
--- a/
src/part00.rs
+++ b/
src/part00.rs
@@
-3,6
+3,13
@@
// Rust-101, Part 00
// =================
// Rust-101, Part 00
// =================
+// As a starter, we want to write a function that computes the minimum of a list.
+// First, we need to get a list. For now, let's just hard-code some sample list.
+// Later, we will ask the user to input a list.
+//
+// Observe how in Rust, the function type comes *after* the arguments (which, in
+// this case, the function does not have). `Vec<i32>` is the type of a growable list
+// of (signed, 32-bit) integers.
pub fn read_vec() -> Vec<i32> {
vec![0,1,2,3,4]
pub fn read_vec() -> Vec<i32> {
vec![0,1,2,3,4]