page 111
This commit is contained in:
parent
f0c8a6b687
commit
66f2f1db23
30
.vimspector.json
Normal file
30
.vimspector.json
Normal file
@ -0,0 +1,30 @@
|
||||
-e { "configurations": { "launch": {
|
||||
"adapter": "CodeLLDB",
|
||||
"filetypes": [ "rust" ],
|
||||
"configuration": {
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/target/debug/rectangles"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-e { "configurations": { "launch": {
|
||||
"adapter": "CodeLLDB",
|
||||
"filetypes": [ "rust" ],
|
||||
"configuration": {
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/target/debug/rectangles"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-e { "configurations": { "launch": {
|
||||
"adapter": "CodeLLDB",
|
||||
"filetypes": [ "rust" ],
|
||||
"configuration": {
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/target/debug/HERE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
chapter6/.vimspector.json
Normal file
10
chapter6/.vimspector.json
Normal file
@ -0,0 +1,10 @@
|
||||
{ "configurations": { "launch": {
|
||||
"adapter": "CodeLLDB",
|
||||
"filetypes": [ "rust" ],
|
||||
"configuration": {
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/target/debug/HERE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
chapter6/coins/.vimspector.json
Normal file
10
chapter6/coins/.vimspector.json
Normal file
@ -0,0 +1,10 @@
|
||||
{ "configurations": { "launch": {
|
||||
"adapter": "CodeLLDB",
|
||||
"filetypes": [ "rust" ],
|
||||
"configuration": {
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/target/debug/coins"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
chapter6/coins/Cargo.lock
generated
Normal file
7
chapter6/coins/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "coins"
|
||||
version = "0.1.0"
|
8
chapter6/coins/Cargo.toml
Normal file
8
chapter6/coins/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "coins"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
24
chapter6/coins/src/main.rs
Normal file
24
chapter6/coins/src/main.rs
Normal file
@ -0,0 +1,24 @@
|
||||
enum Coin {
|
||||
Penny,
|
||||
Nickel,
|
||||
Dime,
|
||||
Quarter,
|
||||
}
|
||||
|
||||
fn value_in_cents(coin: Coin) -> u8 {
|
||||
match coin {
|
||||
Coin::Penny => 1,
|
||||
Coin::Nickel => 5,
|
||||
Coin::Dime => 10,
|
||||
Coin::Quarter => 25,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let v: u8 = value_in_cents(Coin::Dime);
|
||||
let s: String = v.to_string();
|
||||
println!("{}", s);
|
||||
|
||||
}
|
2
justfile
2
justfile
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env -S just --justfile
|
||||
|
||||
vimspector:
|
||||
echo -e "{ \"configurations\": { \"launch\": {\n \"adapter\": \"CodeLLDB\",\n \"filetypes\": [ \"rust\" ],\n \"configuration\": {\n \"request\": \"launch\",\n \"program\": \"\${workspaceRoot}/target/debug/rectangles\"\n }\n }\n }\n }" >> ./.vimspector.json
|
||||
echo -e "{ \"configurations\": { \"launch\": {\n \"adapter\": \"CodeLLDB\",\n \"filetypes\": [ \"rust\" ],\n \"configuration\": {\n \"request\": \"launch\",\n \"program\": \"\${workspaceRoot}/target/debug/HERE\"\n }\n }\n }\n }" >> ./.vimspector.json
|
||||
|
||||
|
||||
p:
|
||||
|
Loading…
Reference in New Issue
Block a user