Skip to content

Commit 273cff3

Browse files
committed
rust
1 parent 652d190 commit 273cff3

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed

rust/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
target
2+
Cargo.lock

rust/.vscode/tasks.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "cargo",
8+
"command": "build",
9+
"problemMatcher": [
10+
"$rustc"
11+
],
12+
"group": {
13+
"kind": "build",
14+
"isDefault": true
15+
},
16+
"label": "rust: cargo build"
17+
},
18+
{
19+
"type": "cargo",
20+
"command": "test",
21+
"problemMatcher": [
22+
"$rustc"
23+
],
24+
"group": {
25+
"kind": "test",
26+
"isDefault": false
27+
},
28+
"label": "rust: cargo test"
29+
}
30+
]
31+
}

rust/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "rust_examples"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

rust/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
all: build
2+
$(MAKE) check
3+
4+
build:
5+
cargo build
6+
7+
clean:
8+
cargo clean
9+
10+
check:
11+
cargo run
12+
doc:
13+
cargo doc
14+
xdg-open target/doc/rust_basics/index.html

rust/src/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main

rust/src/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
all: main
2+
./main
3+
4+
main:
5+
6+
check:
7+
./main
8+
9+
SUFFIXES = .rs
10+
11+
%: %.rs
12+
rustc $<

rust/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// system packages: rust-all rust-src
2+
3+
fn main() {
4+
print!("output");
5+
println!(" + new line");
6+
eprint!("error");
7+
eprintln!(" + new line");
8+
}

0 commit comments

Comments
 (0)