Skip to content

Commit db90ab7

Browse files
committed
docs: Update Rust documentation and add new pages
- Modified journal entries to clarify issues with Claude Code and Bedrock login requirements. - Added new pages for Rust control flow, operators, expressions, and statements, enhancing the overall Rust documentation. - Included examples and explanations for Rust loops, variable initialization, and operator usage. - Updated existing pages to reflect new insights and examples related to Rust programming concepts.
1 parent 0fa1907 commit db90ab7

13 files changed

+274
-6
lines changed

journals/2025_05_23.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- #mise
2525
- [[BUG] JetBrains plugin does not find my mise-installed claude-code · Issue #1230 · anthropics/claude-code](https://github.com/anthropics/claude-code/issues/1230)
2626
- *just in case this happens ... haven't had issues with mise and claude yet*
27-
- #Confused - after an update it seems that [[Claude Code]] now requires a login, even if using [[AWS/Bedrock]], preventing use of Bedrock
27+
- #Confus/ed - after an update it seems that [[Claude Code]] now requires a login, even if using [[AWS/Bedrock]], preventing use of Bedrock
2828
- Neither of these facilitate using bedrock
2929
- ```
3030
╭──────────────────────────╮

journals/2025_11_28.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
- Added [[Book/Rust for Rustaceans]] to knowledge garden
2-
- By [[Person/Jon Gjengset]], published December 2021, 280 pages
3-
- Advanced Rust guide for experienced developers
41
## Rust Study
52
- ### [[Rust/Book/TRPL/Interactive]]
63
- [[Rust/Variable]]
@@ -18,4 +15,7 @@
1815
- [[Rust/Variable/Type/Compound]]
1916
- [[Rust/Variable/Type/Compound/Tuple]]
2017
- [[Programming/Zero Indexing]]
21-
- [[Rust/Variable/Type/Compound/Array]]
18+
- [[Rust/Variable/Type/Compound/Array]]
19+
- Added [[Book/Rust for Rustaceans]] to knowledge garden
20+
- By [[Person/Jon Gjengset]], published December 2021, 280 pages
21+
- Advanced Rust guide for experienced developers

journals/2025_11_29.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Rust Study
2+
- ### [[Rust/Book/TRPL/Interactive]]
3+
- [[Rust/Variable/Type/Compound/Array]]
4+
- [[Rust/Expression]] vs [[Rust/Statement]] is more of a thing than I thought it would be.
5+
- Turns out [[Rust/Variable/let]] doesn't require initialization.
6+
- [[Rust/loop]] can have a [[Rust/break]] keyword that takes a parameter - the item to return. Example:
7+
- ```rust
8+
fn main() {
9+
let mut counter = 0;
10+
11+
let result = loop {
12+
counter += 1;
13+
14+
if counter == 10 {
15+
break counter * 2;
16+
}
17+
};
18+
19+
println!("The result is {result}");
20+
}
21+
```
22+
- Created [[Programming/Operator]] page with general information about operators in programming
23+
- Created [[Rust/Operator]] page (aliased as [[Rust Operators]]) with detailed information from [Appendix B: Operators and Symbols - The Rust Programming Language](https://rust-book.cs.brown.edu/appendix-02-operators.html)
24+
- Includes all Rust operators, their overloadability status, and associated traits
25+
- Released [[Person/codekiln/GitHub/langstar/v0.10.0]] with [[Structured Output]] and evals support.

journals/2025_12_04.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- [[Rust/Control/Flow]]
2+
- [[Rust/loop/label]]

pages/Programming___Operator.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
- # Operator
2+
- A symbol or keyword that performs operations on variables and values
3+
- Fundamental to programming language syntax
4+
- Used in various contexts including arithmetic, comparison, logical operations, and more
5+
- ## Definition
6+
- Operators are special symbols or keywords that perform operations on operands
7+
- Operands are the values or variables that operators act upon
8+
- Operators can be unary (one operand), binary (two operands), or ternary (three operands)
9+
- ## Operator Categories
10+
- ### Arithmetic Operators
11+
- Perform mathematical operations: addition, subtraction, multiplication, division, remainder
12+
- Examples: `+`, `-`, `*`, `/`, `%`
13+
- ### Comparison Operators
14+
- Compare values and return boolean results
15+
- Examples: `==`, `!=`, `<`, `>`, `<=`, `>=`
16+
- ### Logical Operators
17+
- Perform logical operations: AND, OR, NOT
18+
- Examples: `&&`, `||`, `!`
19+
- ### Bitwise Operators
20+
- Perform operations on individual bits
21+
- Examples: `&`, `|`, `^`, `<<`, `>>`
22+
- ### Assignment Operators
23+
- Assign values to variables, often combined with other operations
24+
- Examples: `=`, `+=`, `-=`, `*=`, `/=`
25+
- ### Other Operators
26+
- Language-specific operators for borrowing, dereferencing, pattern matching, error propagation, etc.
27+
- ## Operator Overloading
28+
- Many languages allow operators to be overloaded for custom types
29+
- Enables user-defined types to use standard operator syntax
30+
- Typically implemented through traits or interfaces
31+
- Example: In Rust, operators can be overloaded through traits like `Add`, `Sub`, `Mul`, etc.
32+
- ## Language-Specific Implementations
33+
- Different languages have different operator sets and behaviors
34+
- Some operators are overloadable, others are not
35+
- Operator precedence and associativity vary by language
36+
- ## Related
37+
- [[Rust/Operator]] - Operators in the Rust programming language
38+
- [[Programming/Language/Feature]] - Language features in general
39+
- Arithmetic and mathematical operations
40+
- Type systems and operator overloading
41+

pages/Rust___Control___Flow.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [[Rust/loop]]
2+
- [[Rust/while]]
3+
- [[Rust/for]]

pages/Rust___Expression.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
- via [Functions - The Rust Programming Language](https://rust-book.cs.brown.edu/ch03-03-how-functions-work.html)
2+
- > Expressions **evaluate to a value** ... Consider a math operation, such as `5 + 6`, which is an expression that evaluates to the value `11`. Expressions can be part of statements: ... the `6` in the [[Rust/Statement]] `let y = 6;` is an expression that evaluates to the value `6`. **Calling a [[Rust/Function]] is an expression**. Calling a [[Rust/Macro]] is an expression. A new scope block created with curly brackets is an expression, for example:
3+
- ```rust
4+
fn main() {
5+
let y = {
6+
let x = 3;
7+
x + 1
8+
};
9+
10+
println!("The value of y is: {y}");
11+
}
12+
```
13+
- the expression
14+
- ```rust
15+
{
16+
let x = 3;
17+
x + 1
18+
}
19+
```
20+
- doesn't have semicolon; it just returns 4.
21+
-

pages/Rust___Operator.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
alias:: [[Rust Operators]]
2+
- # Operator
3+
- Operators in Rust are special symbols or keywords that perform operations on variables and values
4+
- Source: [Appendix B: Operators and Symbols - The Rust Programming Language](https://rust-book.cs.brown.edu/appendix-02-operators.html)
5+
- ## Overview
6+
- Rust contains a glossary of operators and other symbols that appear by themselves or in the context of paths, generics, trait bounds, macros, attributes, comments, tuples, and brackets
7+
- Many operators can be overloaded through traits
8+
- ## Operators
9+
- ### Arithmetic Operators
10+
- `+` - Arithmetic addition (overloadable via `Add` trait)
11+
- `+=` - Arithmetic addition and assignment (overloadable via `AddAssign` trait)
12+
- `-` - Arithmetic negation (overloadable via `Neg` trait) or arithmetic subtraction (overloadable via `Sub` trait)
13+
- `-=` - Arithmetic subtraction and assignment (overloadable via `SubAssign` trait)
14+
- `*` - Arithmetic multiplication (overloadable via `Mul` trait) or dereference (overloadable via `Deref` trait)
15+
- `*=` - Arithmetic multiplication and assignment (overloadable via `MulAssign` trait)
16+
- `/` - Arithmetic division (overloadable via `Div` trait)
17+
- `/=` - Arithmetic division and assignment (overloadable via `DivAssign` trait)
18+
- `%` - Arithmetic remainder (overloadable via `Rem` trait)
19+
- `%=` - Arithmetic remainder and assignment (overloadable via `RemAssign` trait)
20+
- ### Comparison Operators
21+
- `==` - Equality comparison (overloadable via `PartialEq` trait)
22+
- `!=` - Nonequality comparison (overloadable via `PartialEq` trait)
23+
- `<` - Less than comparison (overloadable via `PartialOrd` trait)
24+
- `<=` - Less than or equal to comparison (overloadable via `PartialOrd` trait)
25+
- `>` - Greater than comparison (overloadable via `PartialOrd` trait)
26+
- `>=` - Greater than or equal to comparison (overloadable via `PartialOrd` trait)
27+
- ### Logical Operators
28+
- `&&` - Short-circuiting logical AND (not overloadable)
29+
- `||` - Short-circuiting logical OR (not overloadable)
30+
- `!` - Bitwise or logical complement (overloadable via `Not` trait)
31+
- ### Bitwise Operators
32+
- `&` - Bitwise AND (overloadable via `BitAnd` trait) or borrow (`&expr`, `&mut expr` - not overloadable)
33+
- `&=` - Bitwise AND and assignment (overloadable via `BitAndAssign` trait)
34+
- `|` - Bitwise OR (overloadable via `BitOr` trait) or pattern alternatives (`pat | pat` - not overloadable)
35+
- `|=` - Bitwise OR and assignment (overloadable via `BitOrAssign` trait)
36+
- `^` - Bitwise exclusive OR (overloadable via `BitXor` trait)
37+
- `^=` - Bitwise exclusive OR and assignment (overloadable via `BitXorAssign` trait)
38+
- `<<` - Left-shift (overloadable via `Shl` trait)
39+
- `<<=` - Left-shift and assignment (overloadable via `ShlAssign` trait)
40+
- `>>` - Right-shift (overloadable via `Shr` trait)
41+
- `>>=` - Right-shift and assignment (overloadable via `ShrAssign` trait)
42+
- ### Assignment and Other Operators
43+
- `=` - Assignment/equivalence (not overloadable)
44+
- `.` - Field access, method call, or tuple indexing (not overloadable)
45+
- `..` - Right-exclusive range literal (overloadable via `PartialOrd` trait) or struct literal update syntax
46+
- `..=` - Right-inclusive range literal (overloadable via `PartialOrd` trait)
47+
- `->` - Function and closure return type (not overloadable)
48+
- `?` - Error propagation (not overloadable)
49+
- `@` - Pattern binding (not overloadable)
50+
- `:` - Constraints, struct field initializer, or loop label (not overloadable)
51+
- `;` - Statement and item terminator or part of fixed-size array syntax (not overloadable)
52+
- `,` - Argument and element separator (not overloadable)
53+
- `=>` - Part of match arm syntax (not overloadable)
54+
- ## Operator Overloading
55+
- Many operators in Rust can be overloaded through traits
56+
- This allows custom types to use standard operator syntax
57+
- Common overloadable operator traits include:
58+
- `Add`, `Sub`, `Mul`, `Div`, `Rem` for arithmetic operations
59+
- `AddAssign`, `SubAssign`, `MulAssign`, `DivAssign`, `RemAssign` for assignment operations
60+
- `PartialEq`, `PartialOrd` for comparisons
61+
- `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr` for bitwise operations
62+
- `Not`, `Neg` for unary operations
63+
- `Deref` for dereferencing
64+
- ## Non-operator Symbols
65+
- Rust also includes many symbols that don't function as operators
66+
- These include symbols for:
67+
- Paths through the module hierarchy
68+
- Generic type parameters
69+
- Trait bound constraints
70+
- Macros and attributes
71+
- Comments
72+
- Tuples, arrays, and brackets
73+
- ## Related
74+
- [[Programming/Operator]] - General programming concept of operators
75+
- [[Rust/Trait]] - Traits used for operator overloading
76+
- [[Rust/Book/TRPL]] - The Rust Programming Language book
77+
- [[Programming/Language/Feature]] - Language features in general
78+

pages/Rust___Statement.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
- main thing is that statements get semicolons.
2+
- it's possible to have something which doesn't compile because the last line in the function actually has or doesn't have a semicolon.
3+
- It needs to have a semicolon if the last line is a statement.
4+
- It needs to NOT have a semicolon if the last line is a [[Rust/Expression]].
5+
- ```rust
6+
fn main() {
7+
let x = plus_one(5);
8+
9+
println!("The value of x is: {x}");
10+
}
11+
12+
fn plus_one(x: i32) -> i32 {
13+
x + 1; // <- will not compile
14+
}
15+
```
16+
- examples
17+
- `let y = 1;`
18+
-

pages/Rust___Variable___Type___Compound___Array.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
1616
```
1717
- has a **fixed length**
18+
- You can declare it like this ... which is a shorthand for `[3, 3, 3, 3, 3, 3]` - how weird is this? it reminds me of [[c74/max]] in a weird way.
19+
- ```rust
20+
let a = [3; 5];
21+
```
1822
-

0 commit comments

Comments
 (0)