diff --git a/src/lib/components/heroPost.svelte b/src/lib/components/heroPost.svelte index a628764..55c3146 100644 --- a/src/lib/components/heroPost.svelte +++ b/src/lib/components/heroPost.svelte @@ -22,10 +22,10 @@

{title}

{description}

- Avatar of author + {relDate}
@@ -61,6 +61,9 @@ p { font-size: 18px; } + .author { + color: gray; + } .author > * { padding: 0 5px; } diff --git a/src/lib/components/post.svelte b/src/lib/components/post.svelte index 19e0445..05b59b1 100644 --- a/src/lib/components/post.svelte +++ b/src/lib/components/post.svelte @@ -1,10 +1,12 @@ - + {#if thumbnail} Thumbnail {:else} -
+
{/if}
{relDate}
@@ -73,18 +75,23 @@ width: 150px; height: 150px; margin-right: 15px; + margin-top: 5px; object-fit: cover; + box-shadow: 0 0 5px rgb(145, 145, 145); + } + .dark .thumbnail { + box-shadow: 0 0 5px rgb(0, 0, 0); } img { height: 100%; border-radius: 5px; } - .author img { + /* .author img { height: 100%; border-radius: 50%; - } + } */ .author { - height: 2em; + color: gray; display: flex; flex-wrap: wrap; align-items: center; @@ -93,4 +100,7 @@ .author > * { padding: 0 5px; } + p { + margin: 0; + } \ No newline at end of file diff --git a/src/lib/components/posts.svelte b/src/lib/components/posts.svelte index adc49c7..c231631 100644 --- a/src/lib/components/posts.svelte +++ b/src/lib/components/posts.svelte @@ -36,15 +36,14 @@ font-size: 40px; font-weight: 500; max-width: 1360px; - margin: auto; - margin-top: 50px; - margin-bottom: 20px; + margin: 50px auto 30px; } .hero { width: calc(60% - 5px); margin-right: 5px; min-width: 620px; flex-shrink: 0; + margin-bottom: 15px; } .posts { width: calc(40% - 5px); @@ -56,10 +55,11 @@ width: calc(100% - min(120px, 10%)); margin: 0 min(60px, 5%); min-width: initial; + margin-bottom: 15px; } h2 { width: calc(100% - min(120px, 10%)); - margin: 0 min(60px, 5%); + margin: 10px min(60px, 5%) 20px; } .posts { display: flex; diff --git a/src/lib/components/project.svelte b/src/lib/components/project.svelte index 07a73bc..57e28dc 100644 --- a/src/lib/components/project.svelte +++ b/src/lib/components/project.svelte @@ -12,7 +12,7 @@ } -
+
Project @@ -28,7 +28,7 @@

{#each tags as tag, i} - {tag}{#if i !== tags.length - 1}·{/if} + {tag}{#if i !== tags.length - 1}·​{/if} {/each}
View @@ -42,6 +42,8 @@ .tags { margin: 5px 0; margin-left: -3px; + max-width: 100%; + overflow-wrap: normal; } .tags span { padding: 0 3px; diff --git a/src/lib/components/technologyDetails.svelte b/src/lib/components/technologyDetails.svelte index 3773f21..9325865 100644 --- a/src/lib/components/technologyDetails.svelte +++ b/src/lib/components/technologyDetails.svelte @@ -38,6 +38,7 @@

Git + GitHub

I use Git version control system for all of my projects, even if I don't upload them to GitHub. Most of my projects can be found on GitHub.

My GitHub profile is @danbulant.

+

The source code of this website is available here

{:else if selected === "docker"}

Docker + Docker compose + Docker desktop

Docker is the most widely used container runtime. Docker compose makes it easy to orchestrate multiple containers, and finally, Docker desktop is the easiest way to get Docker on Windows.

diff --git a/src/lib/layouts/post.svelte b/src/lib/layouts/post.svelte index 42044c9..4a8e352 100644 --- a/src/lib/layouts/post.svelte +++ b/src/lib/layouts/post.svelte @@ -50,7 +50,7 @@
- Daniel Bulant - Blog posts CC-BY-SA + Daniel Bulant - Blog posts CC-BY-SA (unless otherwise specified)
\ No newline at end of file diff --git a/src/routes/posts/rust-basics/index.md b/src/routes/posts/rust-basics/index.md index 6b879ec..8f81f23 100644 --- a/src/routes/posts/rust-basics/index.md +++ b/src/routes/posts/rust-basics/index.md @@ -1,6 +1,6 @@ --- title: Rust basics, from the perspective of a high level programmer -date: 2022-03-05 +date: 2022-03-06 author: Daniel Bulant authorIcon: /logo.png categories: [programming, rust] @@ -142,6 +142,15 @@ The curly braces are required. Types are either primitives (like numbers and str) or structs (String). Nearly the only difference is that primitives are just written as they are to initialize, but complex types require some kind of constructor. +#### Heap vs Stack + +Heap: +- slower (still really fast) +- bigger + +Stack: + + #### Common primitives Numbers: @@ -151,7 +160,47 @@ Numbers: Strings: - `str` - a simple primitive UTF-8 string (all Rust strings are UTF-8. Invalid UTF-8 strings cannot be used and will throw/panic). Usually used as a pointer (i.e. `&str`) -- `String` - a more complex type, stored on the heap. +- `String` - a more complex type (technically not a primitive), stored on the heap. + +Arrays: +- `T[]` - arrays have a fixed length (they can have fewer elements if you use `Option` type). + +#### Tuples + +Tuples can be used to have multiple values with different types (basically an array with multiple types and fixed size). +Unlike array, they're accesssed directly by the dot notation, i.e. `tuple.0` will get the first item, and tuples don't have methods like `.len()`. + +```rust +let var = (1, "str"); +``` + +An interesting quirk is that you can use `()` (empty tuple) to return "void". Functions that don't have a `return` statement and don't return a value return `()`. + +#### Common structs + +##### Option&lt;T&gt; + +Is an enum (we'll get to how `enum`s work later. They're kind of different from other languages) with either **`Some(T)` or `None`** values. +To get the value, you can use **`match`** like with other enums, or use **`.unwrap()`** (which will panic if it's `None`). + +#### Result&lt;T, E&gt; + +Similar to `Option`, but used to handle errors (commonly returned by IO methods). +It's values are either `Ok(T)` or `Err(E)`. +To get the value, you can again use **`match` block or `.unwrap()`**. + +For easier use, when a function returns `Result`, it can use `?` after calling methods that can return `Result` (where `E` must be of compatible type) to return the error `E` (similar to using `.unwrap()`, but instead of panic makes the function return the error). + +```rust +fn example() -> Result<(), Error> { // An Error type. For simplicity, you can use String, or you can define your own enum. + something_that_returns_result()?; + Ok(()) // returns empty Tuple +} +``` + +#### Vec&lt;T&t;gt; + +`Vec`tors are growable arrays stored on the heap. ### Namespace diff --git a/static/global.css b/static/global.css index 7b0f8b0..dcb8415 100644 --- a/static/global.css +++ b/static/global.css @@ -4,6 +4,10 @@ html, body { min-height: 100vh; } +* { + -webkit-tap-highlight-color: transparent; +} + body { color: #333; margin: 0; diff --git a/static/index.html b/static/index.html deleted file mode 100644 index e1ef5f7..0000000 --- a/static/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - Daniel Bulant - - - - - - - - - - - - -