-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d50eec
commit 6fcdc09
Showing
7 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ package-lock.gz | |
.DS_Store | ||
jsonl | ||
*.out | ||
dist | ||
dist | ||
rust |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "basic" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
run: | ||
cargo watch -x run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Fix the error without removing code line | ||
fn main() { | ||
let s = String::from("hello, world"); | ||
|
||
// print_str(s.clone()); | ||
print_str(s); | ||
|
||
println!("{}", s); | ||
} | ||
|
||
// or use &String | ||
fn print_str(s: String) { | ||
println!("{}",s) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
fn main() { | ||
// 默认不可变变量 | ||
let x = 4; | ||
|
||
// 打印只能通过字符串打印,与 python 一致 | ||
println!("{}", x); | ||
|
||
// 函数加 ! 表示宏 | ||
println!("Hello, world!"); | ||
|
||
let mut y = 3; | ||
println!("{}", y); | ||
y = 10; | ||
println!("{}", y); | ||
|
||
owner(); | ||
} | ||
|
||
fn owner () { | ||
let a = 3; | ||
let b = a; | ||
println!("{}, {}", a, b); | ||
|
||
let s1 = String::from("hello"); | ||
let s2 = s1.clone(); | ||
println!("{}, {}", s2, s2); | ||
} |
6fcdc09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
node-examples – ./
node-examples-shanyue.vercel.app
node-examples.vercel.app
node-examples-git-master-shanyue.vercel.app