Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change ur readme #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 2024年秋冬季操作系统训练营
## 2024年秋冬季操作系统课程



Expand Down
16 changes: 16 additions & 0 deletions exercises/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceFolder}/<executable file>",
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
16 changes: 13 additions & 3 deletions exercises/structs/structs1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@

struct ColorClassicStruct {
// TODO: Something goes here
red:u8,
green:u8,
blue:u8,
}

struct ColorTupleStruct(/* TODO: Something goes here */);
struct ColorTupleStruct(u8,u8,u8);//三个不同字段


#[derive(Debug)]
struct UnitLikeStruct;
Expand All @@ -24,7 +28,12 @@ mod tests {
fn classic_c_structs() {
// TODO: Instantiate a classic c struct!
// let green =

//实例化一个结构体
let green = ColorClassicStruct{
red : 0,
green : 255,
blue : 0,
};
assert_eq!(green.red, 0);
assert_eq!(green.green, 255);
assert_eq!(green.blue, 0);
Expand All @@ -34,7 +43,7 @@ mod tests {
fn tuple_structs() {
// TODO: Instantiate a tuple struct!
// let green =

let green = ColorTupleStruct(0,255,0);
assert_eq!(green.0, 0);
assert_eq!(green.1, 255);
assert_eq!(green.2, 0);
Expand All @@ -44,6 +53,7 @@ mod tests {
fn unit_structs() {
// TODO: Instantiate a unit-like struct!
// let unit_like_struct =
let unit_like_struct = UnitLikeStruct; // 实例化 UnitLikeStruct
let message = format!("{:?}s are fun!", unit_like_struct);

assert_eq!(message, "UnitLikeStructs are fun!");
Expand Down
10 changes: 10 additions & 0 deletions exercises/structs/structs2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ mod tests {
let order_template = create_order_template();
// TODO: Create your own order using the update syntax and template above!
// let your_order =
let your_order = Order {
name: String::from("Hacker in Rust"),
count: 1,
year: 2019,
made_by_phone: false,
made_by_mobile: false,
made_by_email: true,
item_number: 123,
};

assert_eq!(your_order.name, "Hacker in Rust");
assert_eq!(your_order.year, order_template.year);
assert_eq!(your_order.made_by_phone, order_template.made_by_phone);
Expand Down
11 changes: 9 additions & 2 deletions exercises/structs/structs3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ impl Package {
}
}

fn is_international(&self) -> ??? {
fn is_international(&self) -> bool {
// Something goes here...
if self.sender_country != self.recipient_country{
true
}else {
false
}
}

fn get_fees(&self, cents_per_gram: i32) -> ??? {
fn get_fees(&self, cents_per_gram: i32) -> i32 {
// Something goes here...
cents_per_gram*self.weight_in_grams

}
}

Expand Down
30 changes: 30 additions & 0 deletions exercises/variables/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/home/rustOS/rust-rustlings-2024-autumn-noobyalan/target/debug/rustlings", // 确保路径正确
"args": ["example.rs"], // 这里可以添加你的程序参数
"stopAtEntry": false,
"cwd": "/home/rustOS/rust-rustlings-2024-autumn-noobyalan/exercises", // 设置为exercises文件夹
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}