This commit is contained in:
Tyrel Souza 2023-05-26 01:03:08 -04:00
parent f0c8a6b687
commit 66f2f1db23
No known key found for this signature in database
GPG Key ID: F3614B02ACBE438E
7 changed files with 90 additions and 1 deletions

30
.vimspector.json Normal file
View 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
View File

@ -0,0 +1,10 @@
{ "configurations": { "launch": {
"adapter": "CodeLLDB",
"filetypes": [ "rust" ],
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/target/debug/HERE"
}
}
}
}

View 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
View 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"

View 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]

View 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);
}

View File

@ -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: