Skip to content

Commit

Permalink
updated rust posts with ```rust md tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham authored and Graham committed Sep 28, 2024
1 parent 1bca91e commit 1d47fd4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion content/post/2024-09-21-RustClass.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tags: [
</br>
Following is the code for a very basic struct with accessors and mutators.

```
```rust
struct MyStruct{
word: String,
number: i32
Expand Down
6 changes: 3 additions & 3 deletions content/post/2024-09-21-RustTraits.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ In this scenario, I'm imagining that it's very importand to check if a number is
the number seven. I can add a function to the "i32" and "u32" object. I would probably need to do this to i64 too, but
this isn't particularly exciting to reiterate in code below.

```
```rust
trait Sevens {
fn divisible_by_seven(&self) -> bool ;
fn is_seven(&self) -> bool ;
Expand All @@ -39,7 +39,7 @@ impl Sevens for i32 {

And if I want the same to work on u32, I can add this to the code:

```
```rust
impl Sevens for u32 {
fn divisible_by_seven(&self) -> bool{
self%7 == 0
Expand All @@ -54,7 +54,7 @@ And then main can be added (note, these are all in the same file at the moment a
imported another file with a "use" declaration.


```
```rust
fn main() {
let x: i32 = 9;
let y: u32 = 49;
Expand Down
2 changes: 1 addition & 1 deletion content/post/2024-09-28-ImplFrom.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tags: [
# Implement "From" trait...

Basic implementation of From trait to create "MyStruct" from<i32>
```
```rust
struct MyStruct{
word: String,
number: i32
Expand Down

0 comments on commit 1d47fd4

Please sign in to comment.