@grain/stdlib 0.4.0 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/LICENSE +21 -0
- package/README.md +34 -0
- package/array.gr +136 -44
- package/array.md +97 -21
- package/buffer.gr +495 -424
- package/buffer.md +850 -0
- package/bytes.gr +512 -407
- package/bytes.md +621 -0
- package/char.gr +11 -3
- package/hash.gr +26 -3
- package/hash.md +44 -0
- package/list.gr +54 -0
- package/number.gr +24 -6
- package/number.md +49 -17
- package/option.gr +244 -37
- package/option.md +579 -0
- package/package.json +33 -29
- package/queue.gr +98 -29
- package/queue.md +191 -0
- package/range.md +1 -1
- package/regex.gr +3055 -0
- package/regex.md +449 -0
- package/result.gr +216 -70
- package/result.md +446 -0
- package/runtime/gc.gr +2 -2
- package/runtime/string.gr +56 -24
- package/runtime/stringUtils.gr +172 -0
- package/runtime/unsafe/conv.gr +43 -0
- package/set.gr +172 -5
- package/set.md +502 -0
- package/stack.md +143 -0
- package/string.gr +444 -230
- package/string.md +815 -0
- package/sys/file.gr +3 -2
- package/sys/file.md +2 -2
package/sys/file.gr
CHANGED
|
@@ -529,7 +529,7 @@ export let rec fdRead = (fd: FileDescriptor, size: Number) => {
|
|
|
529
529
|
* @param fd: The file descriptor to read from
|
|
530
530
|
* @param offset: The position within the file to begin reading
|
|
531
531
|
* @param size: The maximum number of bytes to read from the file descriptor
|
|
532
|
-
* @returns `Ok((contents, numBytes)) of bytes read and the number of bytes read if successful or `Err(exception)` otherwise
|
|
532
|
+
* @returns `Ok((contents, numBytes))` of bytes read and the number of bytes read if successful or `Err(exception)` otherwise
|
|
533
533
|
*/
|
|
534
534
|
export let rec fdPread = (fd: FileDescriptor, offset: Int64, size: Number) => {
|
|
535
535
|
let fdArg = fd
|
|
@@ -635,7 +635,7 @@ export let rec fdPwrite = (fd: FileDescriptor, data: String, offset: Int64) => {
|
|
|
635
635
|
let mut nwritten = iovs + (3n * 4n)
|
|
636
636
|
|
|
637
637
|
let err = Wasi.fd_pwrite(fd, iovs, 1n, offset, nwritten)
|
|
638
|
-
if (err != Wasi._ESUCCESS) {
|
|
638
|
+
let ret = if (err != Wasi._ESUCCESS) {
|
|
639
639
|
Memory.free(iovs)
|
|
640
640
|
wasmSafeErr(Wasi.SystemError(tagSimpleNumber(err)))
|
|
641
641
|
} else {
|
|
@@ -649,6 +649,7 @@ export let rec fdPwrite = (fd: FileDescriptor, data: String, offset: Int64) => {
|
|
|
649
649
|
Memory.decRef(WasmI32.fromGrain(data))
|
|
650
650
|
Memory.decRef(WasmI32.fromGrain(offsetArg))
|
|
651
651
|
Memory.decRef(WasmI32.fromGrain(fdPwrite))
|
|
652
|
+
ret
|
|
652
653
|
}
|
|
653
654
|
|
|
654
655
|
/**
|
package/sys/file.md
CHANGED
|
@@ -277,7 +277,7 @@ Returns:
|
|
|
277
277
|
|
|
278
278
|
|type|description|
|
|
279
279
|
|----|-----------|
|
|
280
|
-
|`Result<(String, Number), Exception>`|`Ok((contents, numBytes)) of bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
|
|
280
|
+
|`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
|
|
281
281
|
|
|
282
282
|
### File.**fdWrite**
|
|
283
283
|
|
|
@@ -904,7 +904,7 @@ Returns:
|
|
|
904
904
|
|
|
905
905
|
|type|description|
|
|
906
906
|
|----|-----------|
|
|
907
|
-
|`Result<(String, Number), Exception>`|`Ok((contents,
|
|
907
|
+
|`Result<(String, Number), Exception>`|`Ok((contents, numBytes))` of the bytes read and the number of bytes read if successful or `Err(exception)` otherwise|
|
|
908
908
|
|
|
909
909
|
### File.**pathRemoveDirectory**
|
|
910
910
|
|