first steps into rust programming
This commit is contained in:
parent
9c6b9bb42f
commit
3d664633eb
15 changed files with 43 additions and 4 deletions
|
@ -1 +1 @@
|
|||
55aca33b8be45a9e
|
||||
6d8524286a203399
|
|
@ -1 +1 @@
|
|||
{"rustc":9749998217168482212,"target":10994546209011070589,"profile":14528549471338536373,"local":{"variant":"MtimeBased","fields":[[1492003710,242703700],[47,109,101,100,105,97,47,119,105,110,95,101,47,67,108,97,114,97,95,68,97,116,101,110,47,101,116,99,47,80,114,111,103,114,97,109,109,105,101,114,117,110,103,47,82,117,115,116,47,115,114,99,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,104,101,108,108,111,95,119,111,114,108,100,45,57,52,51,56,49,55,100,52,54,99,48,52,52,53,53,56,47,100,101,112,45,98,105,110,45,116,101,115,116,45,57,52,51,56,49,55,100,52,54,99,48,52,52,53,53,56]]},"features":"None","deps":[],"rustflags":[]}
|
||||
{"rustc":9749998217168482212,"target":10994546209011070589,"profile":14528549471338536373,"local":{"variant":"MtimeBased","fields":[[1492017954,643537700],[47,109,101,100,105,97,47,119,105,110,95,101,47,67,108,97,114,97,95,68,97,116,101,110,47,101,116,99,47,80,114,111,103,114,97,109,109,105,101,114,117,110,103,47,82,117,115,116,47,115,114,99,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,104,101,108,108,111,95,119,111,114,108,100,45,57,52,51,56,49,55,100,52,54,99,48,52,52,53,53,56,47,100,101,112,45,98,105,110,45,116,101,115,116,45,57,52,51,56,49,55,100,52,54,99,48,52,52,53,53,56]]},"features":"None","deps":[],"rustflags":[]}
|
Binary file not shown.
Binary file not shown.
4
test.rs
4
test.rs
|
@ -1,9 +1,9 @@
|
|||
// my first rust programm
|
||||
// play & learning with rust
|
||||
// aka "rust playground"
|
||||
|
||||
|
||||
// main function
|
||||
fn main() {
|
||||
println!("Hello world!"); //print to console -> important: here not a tab, but 4 spaces!
|
||||
|
||||
}
|
||||
|
||||
|
|
4
test2/Cargo.lock
generated
Executable file
4
test2/Cargo.lock
generated
Executable file
|
@ -0,0 +1,4 @@
|
|||
[root]
|
||||
name = "test2"
|
||||
version = "0.1.0"
|
||||
|
6
test2/Cargo.toml
Executable file
6
test2/Cargo.toml
Executable file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "test2"
|
||||
version = "0.1.0"
|
||||
authors = ["clara <clara.mueller@vilera.de>"]
|
||||
|
||||
[dependencies]
|
26
test2/src/main.rs
Executable file
26
test2/src/main.rs
Executable file
|
@ -0,0 +1,26 @@
|
|||
// another rust programm
|
||||
// let's get started ^.^
|
||||
|
||||
|
||||
use std::io; // use io library from the standard library
|
||||
// rust only uses few things by default ('prelude') -> add your needs!
|
||||
|
||||
|
||||
//main function
|
||||
fn main() {
|
||||
println!("guess a number!"); // macro, prints string
|
||||
|
||||
println!("please input your guess!."); // macro, prints string
|
||||
|
||||
let mut guess = String::new(); // let -> create 'variable bindings'; String -> string type (UTF-8 encoded bit of text); '::' -> associate function; 'new()' -> created empty
|
||||
let foo = 5; // 'foo' is immutable
|
||||
let mut bar = 5; //'bar' is mutable
|
||||
|
||||
io::stdin().read_line(&mut guess) // calling associated function // without std::io -> written 'std::io::stdin()' //returns handle to standard input
|
||||
// read_line() -> calling method (like associate function, only on parcticular instant of type) an handle
|
||||
// read_line():&mut guess -> passing argument to mutable reference of guess
|
||||
.expect("failed to read line"); // io::Result encodes error handling information // not successful -> panic! with message "failed to read line"
|
||||
|
||||
println!("you guessed: {}", guess); // print out saved string from STDIN
|
||||
println!("FOO: {} & BAR: {}", foo, bar) // print out string variables
|
||||
}
|
0
test2/target/debug/.cargo-lock
Executable file
0
test2/target/debug/.cargo-lock
Executable file
|
@ -0,0 +1 @@
|
|||
ab706db4e0a6cc76
|
|
@ -0,0 +1 @@
|
|||
{"rustc":9749998217168482212,"target":11282531132251368481,"profile":14528549471338536373,"local":{"variant":"MtimeBased","fields":[[1492017977,202731800],[47,109,101,100,105,97,47,119,105,110,95,101,47,67,108,97,114,97,95,68,97,116,101,110,47,101,116,99,47,80,114,111,103,114,97,109,109,105,101,114,117,110,103,47,82,117,115,116,47,115,114,99,47,116,101,115,116,50,47,116,97,114,103,101,116,47,100,101,98,117,103,47,46,102,105,110,103,101,114,112,114,105,110,116,47,116,101,115,116,50,45,48,51,100,54,98,99,48,97,98,102,49,50,51,51,100,100,47,100,101,112,45,98,105,110,45,116,101,115,116,50,45,48,51,100,54,98,99,48,97,98,102,49,50,51,51,100,100]]},"features":"None","deps":[],"rustflags":[]}
|
Binary file not shown.
BIN
test2/target/debug/deps/test2-03d6bc0abf1233dd
Executable file
BIN
test2/target/debug/deps/test2-03d6bc0abf1233dd
Executable file
Binary file not shown.
BIN
test2/target/debug/test2
Executable file
BIN
test2/target/debug/test2
Executable file
Binary file not shown.
1
test2/target/debug/test2.d
Executable file
1
test2/target/debug/test2.d
Executable file
|
@ -0,0 +1 @@
|
|||
/media/win_e/Clara_Daten/etc/Programmierung/Rust/src/test2/target/debug/test2: /media/win_e/Clara_Daten/etc/Programmierung/Rust/src/test2/src/main.rs
|
Loading…
Add table
Add a link
Reference in a new issue