Stephan Rehfeld
|
45cad795a7
|
Use enums
|
2026-04-29 18:40:36 +02:00 |
|
Stephan Rehfeld
|
5daaf9e1bc
|
Iterating over collection using match
|
2026-04-29 18:31:53 +02:00 |
|
Stephan Rehfeld
|
bb45906753
|
Important Rust Pattern: Inheritance does not exist, use enum to store multiple different types in same Collection
|
2026-04-29 18:28:57 +02:00 |
|
Stephan Rehfeld
|
b7a1f52360
|
Putting some Sphere into a Vec
|
2026-04-29 18:19:56 +02:00 |
|
Stephan Rehfeld
|
b1963c7e6a
|
Adding some Geometries
|
2026-04-29 18:14:00 +02:00 |
|
Stephan Rehfeld
|
9ef8e08936
|
Impl Trait add for Point ad Vector3
|
2026-04-29 18:08:30 +02:00 |
|
Stephan Rehfeld
|
31e224f9b0
|
Implementing Div Trait
|
2026-04-29 18:02:48 +02:00 |
|
Stephan Rehfeld
|
07b2fc28d8
|
Implemting multiplication of vector3 with scalar
|
2026-04-29 17:53:40 +02:00 |
|
Stephan Rehfeld
|
31c9bda5a2
|
Implementing Sub for our Vector
|
2026-04-29 17:49:48 +02:00 |
|
Stephan Rehfeld
|
794228dfce
|
Implementing Add for our Vector3
|
2026-04-29 17:47:42 +02:00 |
|
Stephan Rehfeld
|
28df45da67
|
Minimal example to show implementation of traits
|
2026-04-29 17:38:52 +02:00 |
|
Stephan Rehfeld
|
81205e5b29
|
Example with ownership
|
2026-04-29 17:35:33 +02:00 |
|
Stephan Rehfeld
|
07d7855f47
|
CODE DOES NOT Compile
You can't trick the borrow checker, by putting references into another struct
|
2026-04-22 18:36:00 +02:00 |
|
Stephan Rehfeld
|
352085f8d9
|
We need lifitime annotation, when struct wants to old a reference.
|
2026-04-22 18:25:24 +02:00 |
|
Stephan Rehfeld
|
b0e998fb28
|
Either on mutable borrow or inifite immutable borrows are allowed
|
2026-04-22 18:12:55 +02:00 |
|
Stephan Rehfeld
|
7a1b0975d2
|
Example with references and mutable references
|
2026-04-22 17:59:39 +02:00 |
|
Stephan Rehfeld
|
12a54c42da
|
Image example to show Ownership
|
2026-04-15 18:58:16 +02:00 |
|
Stephan Rehfeld
|
bd260f1769
|
Drop and move behavior
|
2026-04-15 18:04:15 +02:00 |
|
Stephan Rehfeld
|
823ec0ad00
|
Move is the default in Rust
|
2026-04-08 19:03:40 +02:00 |
|
Stephan Rehfeld
|
019fbcf095
|
use unwrap_or to get default value
|
2026-04-08 18:46:40 +02:00 |
|
Stephan Rehfeld
|
20c675ef91
|
You can use unwrap to get value. Panics, if result is Err
|
2026-04-08 18:43:12 +02:00 |
|
Stephan Rehfeld
|
6e0e031b12
|
Optional and Result for optional parameters and functions that may fail.
|
2026-04-08 18:41:31 +02:00 |
|
Stephan Rehfeld
|
d5427c96ca
|
Enum values can contain futher values. Use pattern matching to access.
|
2026-04-08 18:19:44 +02:00 |
|
Stephan Rehfeld
|
092e5693b7
|
Simple enum with match
|
2026-04-08 18:16:15 +02:00 |
|
Stephan Rehfeld
|
04520ffa1e
|
Ranges can be reversed
|
2026-04-08 18:05:35 +02:00 |
|
Stephan Rehfeld
|
c77982c642
|
Range syntax
|
2026-04-08 18:05:06 +02:00 |
|
Stephan Rehfeld
|
97e5c2fd72
|
For loop over array
|
2026-04-08 18:03:28 +02:00 |
|
Stephan Rehfeld
|
6316eb4e02
|
Loops can returns values
|
2026-04-08 17:54:28 +02:00 |
|
Stephan Rehfeld
|
c6bba1c4a7
|
Loop loop
|
2026-04-08 17:46:17 +02:00 |
|
Stephan Rehfeld
|
cbc1663ad2
|
While loop
|
2026-04-08 17:43:28 +02:00 |
|
Stephan Rehfeld
|
72541ec0a1
|
If can return values
|
2026-04-08 17:41:15 +02:00 |
|
Stephan Rehfeld
|
8779759e7a
|
Simple if condifition
|
2026-04-08 17:38:49 +02:00 |
|
Stephan Rehfeld
|
f899a55a08
|
Our code so far.
|
2026-04-08 17:28:43 +02:00 |
|