From 792606e00138d57f2877b34c192efe51f220a200 Mon Sep 17 00:00:00 2001 From: darkicewolf50 Date: Fri, 31 Jan 2025 19:28:27 -0700 Subject: [PATCH] fixed spelling --- .obsidian/workspace.json | 98 ++++++------------- Collection of Common Data Structs.md | 2 +- Error Handling.md | 16 +-- Generic Types Traits and Lifetimes.md | 8 +- Generics.md | 2 +- ...ication.md => Reducing_Code_Duplication.md | 0 6 files changed, 42 insertions(+), 84 deletions(-) rename Reducing Code Duplication.md => Reducing_Code_Duplication.md (100%) diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index e70db12..057f416 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,67 +4,20 @@ "type": "split", "children": [ { - "id": "0396922c68d14225", + "id": "9cf638edb21842e3", "type": "tabs", "children": [ { - "id": "bda58467a9a0a34e", + "id": "3025ec3e871a2841", "type": "leaf", "state": { - "type": "markdown", - "state": { - "file": "ownership.md", - "mode": "source", - "source": false - }, + "type": "empty", + "state": {}, "icon": "lucide-file", - "title": "ownership" - } - }, - { - "id": "b80f5219fa24358f", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "Collection of Common Data Structs.md", - "mode": "source", - "source": false - }, - "icon": "lucide-file", - "title": "Collection of Common Data Structs" - } - }, - { - "id": "3a5f95a8df68eb56", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "Error Handling.md", - "mode": "source", - "source": false - }, - "icon": "lucide-file", - "title": "Error Handling" - } - }, - { - "id": "b6a35c226bb40634", - "type": "leaf", - "state": { - "type": "markdown", - "state": { - "file": "data_types.md", - "mode": "source", - "source": false - }, - "icon": "lucide-file", - "title": "data_types" + "title": "New tab" } } - ], - "currentTab": 2 + ] } ], "direction": "vertical" @@ -206,32 +159,37 @@ "command-palette:Open command palette": false } }, - "active": "3a5f95a8df68eb56", + "active": "3025ec3e871a2841", "lastOpenFiles": [ - "Collection of Common Data Structs.md", - "Error Handling.md", - "Hash.md", - "String.md", - "README.md", - "Vector.md", "data_types.md", + "Collection of Common Data Structs.md", + "Constants.md", + "Crates.md", + "Data Types.md", + "Enums.md", + "Error Handling.md", + "Generic Types Traits and Lifetimes.md", + "Generics.md", + "Hash.md", "Modules and Use.md", "ownership.md", - "Project Organization.md", "Packages.md", - "Crates.md", - "crates.io.md", "Paths.md", - "does_not_compile.svg", - "Structures.md", "Primitives.md", + "Project Organization.md", + "README.md", + "Reducing_Code_Duplication.md", + "String.md", + "Structures.md", + "Traits.md", + "Variables.md", + "Vector.md", + "Reducing.md", + "crates.io.md", + "does_not_compile.svg", "Untitled.canvas", - "Enums.md", "Packages and Crates.md", "Good and Bad Code/Commenting Pratices", - "Good and Bad Code", - "Data Types.md", - "Variables.md", - "Constants.md" + "Good and Bad Code" ] } \ No newline at end of file diff --git a/Collection of Common Data Structs.md b/Collection of Common Data Structs.md index 461a871..2543603 100644 --- a/Collection of Common Data Structs.md +++ b/Collection of Common Data Structs.md @@ -21,5 +21,5 @@ choosing the right one is a skill that is developed over time # Summary Here are some exercise that should be able to solve after reading through some of the common collections in the std library - Given a list of integers, use a vector and return the median (when sorted, the value in the middle position) and mode (the value that occurs most often; a hash map will be helpful here) of the list. -- Convert strings to pig latin. The first consonant of each word is moved to the end of the word and ay is added, so first becomes irst-fay. Words that start with a vowel have hay added to the end instead (apple becomes apple-hay). Keep in mind the details about UTF-8 encoding! +- Convert strings to pig Latin. The first consonant of each word is moved to the end of the word and ay is added, so first becomes irst-fay. Words that start with a vowel have hay added to the end instead (apple becomes apple-hay). Keep in mind the details about UTF-8 encoding! - Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company; for example, “Add Sally to Engineering” or “Add Amir to Sales.” Then let the user retrieve a list of all people in a department or all people in the company by department, sorted alphabetically. \ No newline at end of file diff --git a/Error Handling.md b/Error Handling.md index a476860..a81f2f0 100644 --- a/Error Handling.md +++ b/Error Handling.md @@ -1,34 +1,34 @@ # Error Handing This is a factor of life in software, -Rust has a number of features for handling errors. One feature is that Rust requires you to acknowledge the possibility of an error and take some action beofre our code will compile. +Rust has a number of features for handling errors. One feature is that Rust requires you to acknowledge the possibility of an error and take some action before our code will compile. -This requirement ensures that errors are handled before the possiblity could arise +This requirement ensures that errors are handled before the possibility could arise This can be split into two major categories - [*Recoverable*](#recoverable-errors) - File a file not found, just need to report the problem to the user and retry the operation - [*Unrecoverable*](#unrecoverable-errors) - A symptom of bugs, like trying to access a location beyond the end of an array. Need to immediately stop the program -Many languages dont distinguish between the two kinds of errors and handle them the same way using mechanisms such as exceptions +Many languages don't distinguish between the two kinds of errors and handle them the same way using mechanisms such as exceptions Rust does not have exceptions Instead it has the type `Result< T, E>` for recoverable errors -It has the `panc!` macro to stop eecution when an unrecoverable error occurs +It has the `panc!` macro to stop execution when an unrecoverable error occurs ## Unrecoverable Errors -Whne bad things happen in your code and nothing you can do nothing about it then Rust has the `panc!` macro +When bad things happen in your code and nothing you can do nothing about it then Rust has the `panc!` macro There are two ways to cause a panic: -- by taking an action that causes the code to paic (like accessing an array past the end) -- explicity calling `panic!` macro +- by taking an action that causes the code to panic (like accessing an array past the end) +- explicitly calling `panic!` macro By default these print a failure message, unwind, clean up the stack and then quit. Using an environment variable you can also have Rust display the call stack when a panic occurs. This can make it easier to track down the source of the panic -When a call to `panic!` occurs the error message will be contained in the last two lines. The first line will contain our message and the second is when te source of this panic occured +When a call to `panic!` occurs the error message will be contained in the last two lines. The first line will contain our message and the second is when the source of this panic occurred example ```rust diff --git a/Generic Types Traits and Lifetimes.md b/Generic Types Traits and Lifetimes.md index 24fc7d1..9267bbe 100644 --- a/Generic Types Traits and Lifetimes.md +++ b/Generic Types Traits and Lifetimes.md @@ -8,14 +8,14 @@ One of these tools is *generics* They are abstract stand-ins for concrete types or other properties -We can express the behavior of generics or how they relate to other generics without knowing what type that will be in place when copiling and running the code. +We can express the behavior of generics or how they relate to other generics without knowing what type that will be in place when compiling and running the code. -Functions can either take parameters of some generic type or a concrete type (like a `i32` or `String`) in the same way they take parameters with unknwon values to run the same code on multiple concrete values +Functions can either take parameters of some generic type or a concrete type (like a `i32` or `String`) in the same way they take parameters with unknown values to run the same code on multiple concrete values -One examle where concrete values were already used was with `Option`, `Vec`, `HashMap` and `Result` +One example where concrete values were already used was with `Option`, `Vec`, `HashMap` and `Result` This chapter covers 3 things -1. [Reducing Code duplication](Reducing Code Duplication.md) +1. [Reducing Code duplication](Reducing_Code_Duplication.md) 1. [Generics](Generics.md) 1. [Traits](Traits.md) 1. [Lifetimes](Lifetimes.md) \ No newline at end of file diff --git a/Generics.md b/Generics.md index 0a7ad2b..e5a557c 100644 --- a/Generics.md +++ b/Generics.md @@ -1,5 +1,5 @@ # Generic Data Types -These are used to create definitions for items like function signatures or sturctures, where it is then used with many different concrete data types +These are used to create definitions for items like function signatures or structures, where it is then used with many different concrete data types ## In Function Definitions diff --git a/Reducing Code Duplication.md b/Reducing_Code_Duplication.md similarity index 100% rename from Reducing Code Duplication.md rename to Reducing_Code_Duplication.md