Skip to content

Commit

Permalink
Add more examples to README.md (#3)
Browse files Browse the repository at this point in the history
* Add more examples to README

* Add syntax highlighting to new README examples
  • Loading branch information
ozgb committed Apr 6, 2022
1 parent 65cc9d2 commit be4993c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Expand Up @@ -25,3 +25,41 @@ if err != nil {
}
// fmt.Print(buf.Bytes())
```

### Optional Types

```golang
type Person struct {
Name string
Age uint8 `bin:"optional"`
}
```

Rust equivalent:
```rust
struct Person {
name: String,
age: Option<u8>
}
```

### Enum Types

```golang
type MyEnum struct {
Enum bin.BorshEnum `borsh_enum:"true"`
One bin.EmptyVariant
Two uint32
Three int16
}
```

Rust equivalent:
```rust
enum MyEnum {
One,
Two(u32),
Three(i16),
}
```

0 comments on commit be4993c

Please sign in to comment.