nomen-lang 0.0.19 → 0.2.0
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/NOMEN_AGENTS.md +57 -12
- package/core/System/Array.nm +11 -11
- package/core/System/Buffer.nm +2 -2
- package/core/System/Channel.nm +146 -12
- package/core/System/ClassBuffer.nm +2 -2
- package/core/System/Console.nm +28 -17
- package/core/System/Controls/Button.nm +96 -8
- package/core/System/Controls/CheckBox.nm +117 -12
- package/core/System/Controls/Container.nm +114 -8
- package/core/System/Controls/Text.nm +98 -8
- package/core/System/Controls/TextBox.nm +120 -10
- package/core/System/Controls/Window.nm +231 -23
- package/core/System/Graph.nm +1 -1
- package/core/System/Init.nm +4 -8
- package/core/System/LinkedList.nm +1 -1
- package/core/System/List.nm +3 -3
- package/core/System/Map.nm +5 -5
- package/core/System/Math.nm +10 -32
- package/core/System/Result.nm +1 -1
- package/core/System/Set.nm +4 -4
- package/core/System/Stream/Directory.nm +189 -63
- package/core/System/Stream/DirectoryError.nm +21 -0
- package/core/System/Stream/File.nm +339 -141
- package/core/System/Stream/FileError.nm +21 -0
- package/core/System/Stream/Http.nm +109 -44
- package/core/System/Stream/HttpError.nm +20 -0
- package/core/System/String.nm +83 -69
- package/core/System/StringBuilder.nm +11 -13
- package/core/System/Task.nm +46 -12
- package/core/System/Test.nm +1 -1
- package/core/System/Text/Json.nm +5 -3
- package/core/System/Text/JsonTree.nm +23 -14
- package/core/System/Text/Regex.nm +124 -64
- package/core/System/Tree.nm +1 -1
- package/core/System/bool.nm +4 -9
- package/core/System/char.nm +3 -9
- package/core/System/float.nm +2 -1
- package/core/System/float32.nm +44 -0
- package/core/System/float64.nm +44 -0
- package/core/System/int.nm +3 -9
- package/core/System/int16.nm +47 -0
- package/core/System/int32.nm +47 -0
- package/core/System/int64.nm +3 -9
- package/core/System/int8.nm +3 -9
- package/core/System/ufloat.nm +44 -0
- package/core/System/ufloat32.nm +44 -0
- package/core/System/ufloat64.nm +44 -0
- package/core/System/uint.nm +3 -9
- package/core/System/uint16.nm +47 -0
- package/core/System/uint32.nm +47 -0
- package/core/System/uint64.nm +3 -9
- package/core/System/uint8.nm +3 -9
- package/core/docs/System/Channel.md +2 -0
- package/core/docs/System/Result.md +5 -1
- package/core/docs/System/Task.md +1 -1
- package/dist/index.mjs +38794 -21299
- package/package.json +38 -34
- package/src/args.ts +11 -0
- package/src/index.ts +21 -3
- package/src/init.ts +1 -1
- package/src/test.ts +48 -4
- package/src/types/Config.ts +2 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 16-bit signed integer
|
|
3
|
+
**/
|
|
4
|
+
pub struct int16: Stringable, Hashable, Equatable {
|
|
5
|
+
pub func hash = (self, out uint) {
|
|
6
|
+
return self as uint
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
10
|
+
```
|
|
11
|
+
#arch: c
|
|
12
|
+
int length = snprintf(NULL, 0, "%d", self);
|
|
13
|
+
char* str = malloc(length + 1);
|
|
14
|
+
snprintf(str, length + 1, "%d", self);
|
|
15
|
+
return str;
|
|
16
|
+
```
|
|
17
|
+
```
|
|
18
|
+
#arch: aarch64
|
|
19
|
+
sub sp, sp, #128
|
|
20
|
+
str x0, [sp, #0]
|
|
21
|
+
str x1, [sp, #8]
|
|
22
|
+
str x2, [sp, #16]
|
|
23
|
+
str x3, [sp, #24]
|
|
24
|
+
mov x0, xzr
|
|
25
|
+
mov x1, xzr
|
|
26
|
+
adr x2, .Lfmt_int16_d
|
|
27
|
+
mov x3, x19
|
|
28
|
+
bl _snprintf
|
|
29
|
+
add x0, x0, #1
|
|
30
|
+
str x0, [sp, #64]
|
|
31
|
+
bl _malloc
|
|
32
|
+
str x0, [sp, #72]
|
|
33
|
+
ldr x0, [sp, #72]
|
|
34
|
+
ldr x1, [sp, #64]
|
|
35
|
+
adr x2, .Lfmt_int16_d
|
|
36
|
+
mov x3, x19
|
|
37
|
+
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
39
|
+
ldr x0, [sp, #72]
|
|
40
|
+
add sp, sp, #128
|
|
41
|
+
b .Lend_int16_to_string
|
|
42
|
+
.Lfmt_int16_d: .asciz "%d"
|
|
43
|
+
.p2align 2
|
|
44
|
+
.Lend_int16_to_string:
|
|
45
|
+
```
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 32-bit signed integer
|
|
3
|
+
**/
|
|
4
|
+
pub struct int32: Stringable, Hashable, Equatable {
|
|
5
|
+
pub func hash = (self, out uint) {
|
|
6
|
+
return self as uint
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
10
|
+
```
|
|
11
|
+
#arch: c
|
|
12
|
+
int length = snprintf(NULL, 0, "%d", self);
|
|
13
|
+
char* str = malloc(length + 1);
|
|
14
|
+
snprintf(str, length + 1, "%d", self);
|
|
15
|
+
return str;
|
|
16
|
+
```
|
|
17
|
+
```
|
|
18
|
+
#arch: aarch64
|
|
19
|
+
sub sp, sp, #128
|
|
20
|
+
str x0, [sp, #0]
|
|
21
|
+
str x1, [sp, #8]
|
|
22
|
+
str x2, [sp, #16]
|
|
23
|
+
str x3, [sp, #24]
|
|
24
|
+
mov x0, xzr
|
|
25
|
+
mov x1, xzr
|
|
26
|
+
adr x2, .Lfmt_int32_d
|
|
27
|
+
mov x3, x19
|
|
28
|
+
bl _snprintf
|
|
29
|
+
add x0, x0, #1
|
|
30
|
+
str x0, [sp, #64]
|
|
31
|
+
bl _malloc
|
|
32
|
+
str x0, [sp, #72]
|
|
33
|
+
ldr x0, [sp, #72]
|
|
34
|
+
ldr x1, [sp, #64]
|
|
35
|
+
adr x2, .Lfmt_int32_d
|
|
36
|
+
mov x3, x19
|
|
37
|
+
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
39
|
+
ldr x0, [sp, #72]
|
|
40
|
+
add sp, sp, #128
|
|
41
|
+
b .Lend_int32_to_string
|
|
42
|
+
.Lfmt_int32_d: .asciz "%d"
|
|
43
|
+
.p2align 2
|
|
44
|
+
.Lend_int32_to_string:
|
|
45
|
+
```
|
|
46
|
+
}
|
|
47
|
+
}
|
package/core/System/int64.nm
CHANGED
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
**/
|
|
4
4
|
pub struct int64: Stringable, Hashable, Equatable {
|
|
5
5
|
pub func hash = (self, out uint) {
|
|
6
|
-
|
|
7
|
-
#arch: c
|
|
8
|
-
return (unsigned long)self;
|
|
9
|
-
```
|
|
10
|
-
```
|
|
11
|
-
#arch: aarch64
|
|
12
|
-
mov x0, x19
|
|
13
|
-
```
|
|
6
|
+
return self as uint
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
pub func to_string = (self, out string) {
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
17
10
|
```
|
|
18
11
|
#arch: c
|
|
19
12
|
int length = snprintf(NULL, 0, "%lld", self);
|
|
@@ -42,6 +35,7 @@ pub struct int64: Stringable, Hashable, Equatable {
|
|
|
42
35
|
adr x2, .Lfmt_int64_lld
|
|
43
36
|
mov x3, x19
|
|
44
37
|
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
45
39
|
ldr x0, [sp, #72]
|
|
46
40
|
add sp, sp, #128
|
|
47
41
|
b .Lend_int64_to_string
|
package/core/System/int8.nm
CHANGED
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
**/
|
|
4
4
|
pub struct int8: Stringable, Hashable, Equatable {
|
|
5
5
|
pub func hash = (self, out uint) {
|
|
6
|
-
|
|
7
|
-
#arch: c
|
|
8
|
-
return (unsigned long)self;
|
|
9
|
-
```
|
|
10
|
-
```
|
|
11
|
-
#arch: aarch64
|
|
12
|
-
mov x0, x19
|
|
13
|
-
```
|
|
6
|
+
return self as uint
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
pub func to_string = (self, out string) {
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
17
10
|
```
|
|
18
11
|
#arch: c
|
|
19
12
|
int length = snprintf(NULL, 0, "%d", self);
|
|
@@ -42,6 +35,7 @@ pub struct int8: Stringable, Hashable, Equatable {
|
|
|
42
35
|
adr x2, .Lfmt_int8_d
|
|
43
36
|
mov x3, x19
|
|
44
37
|
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
45
39
|
ldr x0, [sp, #72]
|
|
46
40
|
add sp, sp, #128
|
|
47
41
|
b .Lend_int8_to_string
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An unsigned double-precision (64-bit) floating-point number
|
|
3
|
+
**/
|
|
4
|
+
pub struct ufloat: Stringable {
|
|
5
|
+
pub func to_string = (self, move out string) {
|
|
6
|
+
```
|
|
7
|
+
#arch: c
|
|
8
|
+
int length = snprintf(NULL, 0, "%f", self);
|
|
9
|
+
char* str = malloc(length + 1);
|
|
10
|
+
snprintf(str, length + 1, "%f", self);
|
|
11
|
+
return str;
|
|
12
|
+
```
|
|
13
|
+
```
|
|
14
|
+
#arch: aarch64
|
|
15
|
+
sub sp, sp, #128
|
|
16
|
+
str x0, [sp, #0]
|
|
17
|
+
str x1, [sp, #8]
|
|
18
|
+
str x2, [sp, #16]
|
|
19
|
+
str x3, [sp, #24]
|
|
20
|
+
str d0, [sp, #64]
|
|
21
|
+
mov x0, xzr
|
|
22
|
+
mov x1, xzr
|
|
23
|
+
adr x2, .Lfmt_ufloat_f
|
|
24
|
+
fmov d0, x19
|
|
25
|
+
bl _snprintf
|
|
26
|
+
add x0, x0, #1
|
|
27
|
+
str x0, [sp, #64]
|
|
28
|
+
bl _malloc
|
|
29
|
+
str x0, [sp, #72]
|
|
30
|
+
ldr x0, [sp, #72]
|
|
31
|
+
ldr x1, [sp, #64]
|
|
32
|
+
adr x2, .Lfmt_ufloat_f
|
|
33
|
+
fmov d0, x19
|
|
34
|
+
bl _snprintf
|
|
35
|
+
mov x1, x0
|
|
36
|
+
ldr x0, [sp, #72]
|
|
37
|
+
add sp, sp, #128
|
|
38
|
+
b .Lend_ufloat_to_string
|
|
39
|
+
.Lfmt_ufloat_f: .asciz "%f"
|
|
40
|
+
.p2align 2
|
|
41
|
+
.Lend_ufloat_to_string:
|
|
42
|
+
```
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An unsigned double-precision (64-bit) floating-point number
|
|
3
|
+
**/
|
|
4
|
+
pub struct ufloat32: Stringable {
|
|
5
|
+
pub func to_string = (self, move out string) {
|
|
6
|
+
```
|
|
7
|
+
#arch: c
|
|
8
|
+
int length = snprintf(NULL, 0, "%f", self);
|
|
9
|
+
char* str = malloc(length + 1);
|
|
10
|
+
snprintf(str, length + 1, "%f", self);
|
|
11
|
+
return str;
|
|
12
|
+
```
|
|
13
|
+
```
|
|
14
|
+
#arch: aarch64
|
|
15
|
+
sub sp, sp, #128
|
|
16
|
+
str x0, [sp, #0]
|
|
17
|
+
str x1, [sp, #8]
|
|
18
|
+
str x2, [sp, #16]
|
|
19
|
+
str x3, [sp, #24]
|
|
20
|
+
str d0, [sp, #64]
|
|
21
|
+
mov x0, xzr
|
|
22
|
+
mov x1, xzr
|
|
23
|
+
adr x2, .Lfmt_ufloat32_f
|
|
24
|
+
fmov d0, x19
|
|
25
|
+
bl _snprintf
|
|
26
|
+
add x0, x0, #1
|
|
27
|
+
str x0, [sp, #64]
|
|
28
|
+
bl _malloc
|
|
29
|
+
str x0, [sp, #72]
|
|
30
|
+
ldr x0, [sp, #72]
|
|
31
|
+
ldr x1, [sp, #64]
|
|
32
|
+
adr x2, .Lfmt_ufloat32_f
|
|
33
|
+
fmov d0, x19
|
|
34
|
+
bl _snprintf
|
|
35
|
+
mov x1, x0
|
|
36
|
+
ldr x0, [sp, #72]
|
|
37
|
+
add sp, sp, #128
|
|
38
|
+
b .Lend_ufloat32_to_string
|
|
39
|
+
.Lfmt_ufloat32_f: .asciz "%f"
|
|
40
|
+
.p2align 2
|
|
41
|
+
.Lend_ufloat32_to_string:
|
|
42
|
+
```
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An unsigned double-precision (64-bit) floating-point number
|
|
3
|
+
**/
|
|
4
|
+
pub struct ufloat64: Stringable {
|
|
5
|
+
pub func to_string = (self, move out string) {
|
|
6
|
+
```
|
|
7
|
+
#arch: c
|
|
8
|
+
int length = snprintf(NULL, 0, "%f", self);
|
|
9
|
+
char* str = malloc(length + 1);
|
|
10
|
+
snprintf(str, length + 1, "%f", self);
|
|
11
|
+
return str;
|
|
12
|
+
```
|
|
13
|
+
```
|
|
14
|
+
#arch: aarch64
|
|
15
|
+
sub sp, sp, #128
|
|
16
|
+
str x0, [sp, #0]
|
|
17
|
+
str x1, [sp, #8]
|
|
18
|
+
str x2, [sp, #16]
|
|
19
|
+
str x3, [sp, #24]
|
|
20
|
+
str d0, [sp, #64]
|
|
21
|
+
mov x0, xzr
|
|
22
|
+
mov x1, xzr
|
|
23
|
+
adr x2, .Lfmt_ufloat64_f
|
|
24
|
+
fmov d0, x19
|
|
25
|
+
bl _snprintf
|
|
26
|
+
add x0, x0, #1
|
|
27
|
+
str x0, [sp, #64]
|
|
28
|
+
bl _malloc
|
|
29
|
+
str x0, [sp, #72]
|
|
30
|
+
ldr x0, [sp, #72]
|
|
31
|
+
ldr x1, [sp, #64]
|
|
32
|
+
adr x2, .Lfmt_ufloat64_f
|
|
33
|
+
fmov d0, x19
|
|
34
|
+
bl _snprintf
|
|
35
|
+
mov x1, x0
|
|
36
|
+
ldr x0, [sp, #72]
|
|
37
|
+
add sp, sp, #128
|
|
38
|
+
b .Lend_ufloat64_to_string
|
|
39
|
+
.Lfmt_ufloat64_f: .asciz "%f"
|
|
40
|
+
.p2align 2
|
|
41
|
+
.Lend_ufloat64_to_string:
|
|
42
|
+
```
|
|
43
|
+
}
|
|
44
|
+
}
|
package/core/System/uint.nm
CHANGED
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
**/
|
|
4
4
|
pub struct uint: Stringable, Hashable, Equatable {
|
|
5
5
|
pub func hash = (self, out uint) {
|
|
6
|
-
|
|
7
|
-
#arch: c
|
|
8
|
-
return (unsigned long)self;
|
|
9
|
-
```
|
|
10
|
-
```
|
|
11
|
-
#arch: aarch64
|
|
12
|
-
mov x0, x19
|
|
13
|
-
```
|
|
6
|
+
return self
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
pub func to_string = (self, out string) {
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
17
10
|
```
|
|
18
11
|
#arch: c
|
|
19
12
|
int length = snprintf(NULL, 0, "%ld", self);
|
|
@@ -42,6 +35,7 @@ pub struct uint: Stringable, Hashable, Equatable {
|
|
|
42
35
|
adr x2, .Lfmt_uint_ld
|
|
43
36
|
mov x3, x19
|
|
44
37
|
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
45
39
|
ldr x0, [sp, #72]
|
|
46
40
|
add sp, sp, #128
|
|
47
41
|
b .Lend_uint_to_string
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 16-bit unsigned integer
|
|
3
|
+
**/
|
|
4
|
+
pub struct uint16: Stringable, Hashable, Equatable {
|
|
5
|
+
pub func hash = (self, out uint) {
|
|
6
|
+
return self as uint
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
10
|
+
```
|
|
11
|
+
#arch: c
|
|
12
|
+
int length = snprintf(NULL, 0, "%u", self);
|
|
13
|
+
char* str = malloc(length + 1);
|
|
14
|
+
snprintf(str, length + 1, "%u", self);
|
|
15
|
+
return str;
|
|
16
|
+
```
|
|
17
|
+
```
|
|
18
|
+
#arch: aarch64
|
|
19
|
+
sub sp, sp, #128
|
|
20
|
+
str x0, [sp, #0]
|
|
21
|
+
str x1, [sp, #8]
|
|
22
|
+
str x2, [sp, #16]
|
|
23
|
+
str x3, [sp, #24]
|
|
24
|
+
mov x0, xzr
|
|
25
|
+
mov x1, xzr
|
|
26
|
+
adr x2, .Lfmt_uint16_u
|
|
27
|
+
mov x3, x19
|
|
28
|
+
bl _snprintf
|
|
29
|
+
add x0, x0, #1
|
|
30
|
+
str x0, [sp, #64]
|
|
31
|
+
bl _malloc
|
|
32
|
+
str x0, [sp, #72]
|
|
33
|
+
ldr x0, [sp, #72]
|
|
34
|
+
ldr x1, [sp, #64]
|
|
35
|
+
adr x2, .Lfmt_uint16_u
|
|
36
|
+
mov x3, x19
|
|
37
|
+
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
39
|
+
ldr x0, [sp, #72]
|
|
40
|
+
add sp, sp, #128
|
|
41
|
+
b .Lend_uint16_to_string
|
|
42
|
+
.Lfmt_uint16_u: .asciz "%u"
|
|
43
|
+
.p2align 2
|
|
44
|
+
.Lend_uint16_to_string:
|
|
45
|
+
```
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A 32-bit unsigned integer
|
|
3
|
+
**/
|
|
4
|
+
pub struct uint32: Stringable, Hashable, Equatable {
|
|
5
|
+
pub func hash = (self, out uint) {
|
|
6
|
+
return self as uint
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
10
|
+
```
|
|
11
|
+
#arch: c
|
|
12
|
+
int length = snprintf(NULL, 0, "%u", self);
|
|
13
|
+
char* str = malloc(length + 1);
|
|
14
|
+
snprintf(str, length + 1, "%u", self);
|
|
15
|
+
return str;
|
|
16
|
+
```
|
|
17
|
+
```
|
|
18
|
+
#arch: aarch64
|
|
19
|
+
sub sp, sp, #128
|
|
20
|
+
str x0, [sp, #0]
|
|
21
|
+
str x1, [sp, #8]
|
|
22
|
+
str x2, [sp, #16]
|
|
23
|
+
str x3, [sp, #24]
|
|
24
|
+
mov x0, xzr
|
|
25
|
+
mov x1, xzr
|
|
26
|
+
adr x2, .Lfmt_uint32_u
|
|
27
|
+
mov x3, x19
|
|
28
|
+
bl _snprintf
|
|
29
|
+
add x0, x0, #1
|
|
30
|
+
str x0, [sp, #64]
|
|
31
|
+
bl _malloc
|
|
32
|
+
str x0, [sp, #72]
|
|
33
|
+
ldr x0, [sp, #72]
|
|
34
|
+
ldr x1, [sp, #64]
|
|
35
|
+
adr x2, .Lfmt_uint32_u
|
|
36
|
+
mov x3, x19
|
|
37
|
+
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
39
|
+
ldr x0, [sp, #72]
|
|
40
|
+
add sp, sp, #128
|
|
41
|
+
b .Lend_uint32_to_string
|
|
42
|
+
.Lfmt_uint32_u: .asciz "%u"
|
|
43
|
+
.p2align 2
|
|
44
|
+
.Lend_uint32_to_string:
|
|
45
|
+
```
|
|
46
|
+
}
|
|
47
|
+
}
|
package/core/System/uint64.nm
CHANGED
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
**/
|
|
4
4
|
pub struct uint64: Stringable, Hashable, Equatable {
|
|
5
5
|
pub func hash = (self, out uint) {
|
|
6
|
-
|
|
7
|
-
#arch: c
|
|
8
|
-
return (unsigned long)self;
|
|
9
|
-
```
|
|
10
|
-
```
|
|
11
|
-
#arch: aarch64
|
|
12
|
-
mov x0, x19
|
|
13
|
-
```
|
|
6
|
+
return self as uint
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
pub func to_string = (self, out string) {
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
17
10
|
```
|
|
18
11
|
#arch: c
|
|
19
12
|
int length = snprintf(NULL, 0, "%llu", self);
|
|
@@ -42,6 +35,7 @@ pub struct uint64: Stringable, Hashable, Equatable {
|
|
|
42
35
|
adr x2, .Lfmt_uint64_llu
|
|
43
36
|
mov x3, x19
|
|
44
37
|
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
45
39
|
ldr x0, [sp, #72]
|
|
46
40
|
add sp, sp, #128
|
|
47
41
|
b .Lend_uint64_to_string
|
package/core/System/uint8.nm
CHANGED
|
@@ -3,17 +3,10 @@
|
|
|
3
3
|
**/
|
|
4
4
|
pub struct uint8: Stringable, Hashable, Equatable {
|
|
5
5
|
pub func hash = (self, out uint) {
|
|
6
|
-
|
|
7
|
-
#arch: c
|
|
8
|
-
return (unsigned long)self;
|
|
9
|
-
```
|
|
10
|
-
```
|
|
11
|
-
#arch: aarch64
|
|
12
|
-
mov x0, x19
|
|
13
|
-
```
|
|
6
|
+
return self as uint
|
|
14
7
|
}
|
|
15
8
|
|
|
16
|
-
pub func to_string = (self, out string) {
|
|
9
|
+
pub func to_string = (self, move out string) {
|
|
17
10
|
```
|
|
18
11
|
#arch: c
|
|
19
12
|
int length = snprintf(NULL, 0, "%d", self);
|
|
@@ -42,6 +35,7 @@ pub struct uint8: Stringable, Hashable, Equatable {
|
|
|
42
35
|
adr x2, .Lfmt_uint8_d
|
|
43
36
|
mov x3, x19
|
|
44
37
|
bl _snprintf
|
|
38
|
+
mov x1, x0
|
|
45
39
|
ldr x0, [sp, #72]
|
|
46
40
|
add sp, sp, #128
|
|
47
41
|
b .Lend_uint8_to_string
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
# Result
|
|
2
2
|
|
|
3
|
-
## `enum Result<T, E>`
|
|
3
|
+
## `must_use enum Result<T, E>`
|
|
4
4
|
|
|
5
5
|
A generic result type with an `ok(T value)` success case and an
|
|
6
6
|
`error(E error)` failure case. Monomorphized per concrete type-argument pair
|
|
7
7
|
(e.g. `Result<int, string>`).
|
|
8
8
|
|
|
9
|
+
`Result` is declared `must_use`: a statement-position call that returns a
|
|
10
|
+
`Result` is a compile error unless the value is bound or matched. Ignore it
|
|
11
|
+
deliberately with `var _ = f.close()`, or handle both cases with `match`.
|
|
12
|
+
|
|
9
13
|
```
|
|
10
14
|
func parse_age = (string s, out Result<int, string>) {
|
|
11
15
|
return .error("not a number")
|
package/core/docs/System/Task.md
CHANGED
|
@@ -7,7 +7,7 @@ A handle to an asynchronously-running computation, backed by a shared thread poo
|
|
|
7
7
|
**Members:**
|
|
8
8
|
|
|
9
9
|
- `wait()`
|
|
10
|
-
- `result() -> T`
|
|
10
|
+
- `result() -> T` (moves the value out — call once; the caller owns it)
|
|
11
11
|
- `result_uint64() -> uint64`
|
|
12
12
|
- `cancel()`
|
|
13
13
|
- `current_cancelled() -> bool`
|