Skip to content

Commit

Permalink
add zero initializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr committed Sep 11, 2024
1 parent 681bff9 commit d609ef8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/api/05-language-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1233,12 +1233,14 @@ let rawData: bytes = bytes.fromRaw([104, 101, 108, 108, 111]);
let rawString: bytes = bytes.fromString("hello");
let base64: bytes = bytes.fromBase64("aGVsbG8=");
let hex: bytes = bytes.fromHex("68656c6c6f");
let zeroes: bytes = bytes.alloc(20); // allocates 20 zeroed bytes
// mutable initializers
let rawDataMut: mutbytes = mutbytes.fromRaw([104, 101, 108, 108, 111]);
let rawStringMut: mutbytes = mutbytes.fromString("hello");
let base64Mut: mutbytes = mutbytes.fromBase64("aGVsbG8=");
let hexMut: mutbytes = mutbytes.fromHex("68656c6c6f");
let zeroesMut: mutbytes = mutbytes.alloc(20); // allocates 20 zeroed bytes
```
#### Converting bytes to other types
Expand Down

0 comments on commit d609ef8

Please sign in to comment.