happy-rusty 1.1.2 → 1.3.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.
@@ -25,6 +25,12 @@ pub enum Result<T, E> {
25
25
  | `T` | The type of the value contained in a successful `Result`. |
26
26
  | `E` | The type of the error contained in an unsuccessful `Result`. |
27
27
 
28
+ ## Properties
29
+
30
+ | Property | Type | Description | Defined in |
31
+ | ------ | ------ | ------ | ------ |
32
+ | `[toStringTag]` | `"Result"` | [object Result]. | [core.ts:304](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L304) |
33
+
28
34
  ## Methods
29
35
 
30
36
  ### and()
@@ -55,7 +61,7 @@ The passed `Result` if `this` is `Ok`, otherwise returns `this` (which is `Err`)
55
61
 
56
62
  #### Defined in
57
63
 
58
- [prelude.ts:516](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L516)
64
+ [core.ts:489](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L489)
59
65
 
60
66
  ***
61
67
 
@@ -87,7 +93,7 @@ The result of `fn` if `this` is `Ok`, otherwise `this` as `Err`.
87
93
 
88
94
  #### Defined in
89
95
 
90
- [prelude.ts:532](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L532)
96
+ [core.ts:505](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L505)
91
97
 
92
98
  ***
93
99
 
@@ -116,7 +122,7 @@ Just same as `result as unknown as Result<U, E>`.
116
122
 
117
123
  #### Defined in
118
124
 
119
- [prelude.ts:590](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L590)
125
+ [core.ts:563](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L563)
120
126
 
121
127
  ***
122
128
 
@@ -144,7 +150,7 @@ Just same as `result as unknown as Result<T, F>`.
144
150
 
145
151
  #### Defined in
146
152
 
147
- [prelude.ts:579](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L579)
153
+ [core.ts:552](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L552)
148
154
 
149
155
  ***
150
156
 
@@ -170,7 +176,7 @@ Tests whether `this` and `other` are both `Ok` containing equal values, or both
170
176
 
171
177
  #### Defined in
172
178
 
173
- [prelude.ts:567](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L567)
179
+ [core.ts:540](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L540)
174
180
 
175
181
  ***
176
182
 
@@ -190,7 +196,7 @@ If the result is `Ok`, returns `None`.
190
196
 
191
197
  #### Defined in
192
198
 
193
- [prelude.ts:440](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L440)
199
+ [core.ts:413](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L413)
194
200
 
195
201
  ***
196
202
 
@@ -218,7 +224,7 @@ Throws an error with the provided message if the result is an `Err`.
218
224
 
219
225
  #### Defined in
220
226
 
221
- [prelude.ts:383](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L383)
227
+ [core.ts:356](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L356)
222
228
 
223
229
  ***
224
230
 
@@ -246,7 +252,7 @@ Throws an error with the provided message if the result is an `Ok`.
246
252
 
247
253
  #### Defined in
248
254
 
249
- [prelude.ts:412](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L412)
255
+ [core.ts:385](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L385)
250
256
 
251
257
  ***
252
258
 
@@ -278,7 +284,7 @@ If the result is `Ok(Err(E))` or `Err(E)`, returns `Err(E)`.
278
284
 
279
285
  #### Defined in
280
286
 
281
- [prelude.ts:500](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L500)
287
+ [core.ts:473](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L473)
282
288
 
283
289
  ***
284
290
 
@@ -305,7 +311,7 @@ Does not modify the `Result`.
305
311
 
306
312
  #### Defined in
307
313
 
308
- [prelude.ts:550](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L550)
314
+ [core.ts:523](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L523)
309
315
 
310
316
  ***
311
317
 
@@ -332,7 +338,7 @@ Does not modify the `Result`.
332
338
 
333
339
  #### Defined in
334
340
 
335
- [prelude.ts:558](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L558)
341
+ [core.ts:531](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L531)
336
342
 
337
343
  ***
338
344
 
@@ -350,7 +356,7 @@ Returns `true` if the result is `Err`.
350
356
 
351
357
  #### Defined in
352
358
 
353
- [prelude.ts:356](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L356)
359
+ [core.ts:329](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L329)
354
360
 
355
361
  ***
356
362
 
@@ -374,7 +380,7 @@ Returns `true` if the result is `Err` and the provided predicate returns `true`
374
380
 
375
381
  #### Defined in
376
382
 
377
- [prelude.ts:368](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L368)
383
+ [core.ts:341](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L341)
378
384
 
379
385
  ***
380
386
 
@@ -392,7 +398,7 @@ Returns `true` if the result is `Ok`.
392
398
 
393
399
  #### Defined in
394
400
 
395
- [prelude.ts:351](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L351)
401
+ [core.ts:324](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L324)
396
402
 
397
403
  ***
398
404
 
@@ -416,7 +422,7 @@ Returns `true` if the result is `Ok` and the provided predicate returns `true` f
416
422
 
417
423
  #### Defined in
418
424
 
419
- [prelude.ts:362](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L362)
425
+ [core.ts:335](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L335)
420
426
 
421
427
  ***
422
428
 
@@ -447,7 +453,7 @@ leaving an `Err` value untouched.
447
453
 
448
454
  #### Defined in
449
455
 
450
- [prelude.ts:461](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L461)
456
+ [core.ts:434](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L434)
451
457
 
452
458
  ***
453
459
 
@@ -478,7 +484,7 @@ leaving an `Ok` value untouched.
478
484
 
479
485
  #### Defined in
480
486
 
481
- [prelude.ts:473](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L473)
487
+ [core.ts:446](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L446)
482
488
 
483
489
  ***
484
490
 
@@ -509,7 +515,7 @@ Maps a `Result<T, E>` to `U` by applying a function to the contained `Ok` value
509
515
 
510
516
  #### Defined in
511
517
 
512
- [prelude.ts:485](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L485)
518
+ [core.ts:458](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L458)
513
519
 
514
520
  ***
515
521
 
@@ -540,7 +546,7 @@ Maps a `Result<T, E>` to `U` by applying a function to the contained `Ok` value
540
546
 
541
547
  #### Defined in
542
548
 
543
- [prelude.ts:493](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L493)
549
+ [core.ts:466](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L466)
544
550
 
545
551
  ***
546
552
 
@@ -560,7 +566,7 @@ If the result is `Err`, returns `None`.
560
566
 
561
567
  #### Defined in
562
568
 
563
- [prelude.ts:433](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L433)
569
+ [core.ts:406](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L406)
564
570
 
565
571
  ***
566
572
 
@@ -592,7 +598,7 @@ Returns `this` if it is `Ok`, otherwise returns the passed `Result`.
592
598
 
593
599
  #### Defined in
594
600
 
595
- [prelude.ts:524](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L524)
601
+ [core.ts:497](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L497)
596
602
 
597
603
  ***
598
604
 
@@ -624,7 +630,25 @@ The result of `fn` if `this` is `Err`, otherwise `this` as `Ok`.
624
630
 
625
631
  #### Defined in
626
632
 
627
- [prelude.ts:540](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L540)
633
+ [core.ts:513](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L513)
634
+
635
+ ***
636
+
637
+ ### toString()
638
+
639
+ ```ts
640
+ toString(): string
641
+ ```
642
+
643
+ Custom `toString` implementation that uses the `Result`'s contained value.
644
+
645
+ #### Returns
646
+
647
+ `string`
648
+
649
+ #### Defined in
650
+
651
+ [core.ts:568](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L568)
628
652
 
629
653
  ***
630
654
 
@@ -658,7 +682,7 @@ Transposes a `Result` of an `Option` into an `Option` of a `Result`.
658
682
 
659
683
  #### Defined in
660
684
 
661
- [prelude.ts:449](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L449)
685
+ [core.ts:422](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L422)
662
686
 
663
687
  ***
664
688
 
@@ -680,7 +704,7 @@ Throws an error if the result is an `Err`.
680
704
 
681
705
  #### Defined in
682
706
 
683
- [prelude.ts:389](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L389)
707
+ [core.ts:362](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L362)
684
708
 
685
709
  ***
686
710
 
@@ -702,7 +726,7 @@ Throws an error if the result is an `Ok`.
702
726
 
703
727
  #### Defined in
704
728
 
705
- [prelude.ts:418](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L418)
729
+ [core.ts:391](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L391)
706
730
 
707
731
  ***
708
732
 
@@ -726,7 +750,7 @@ Returns the contained `Ok` value or a provided default.
726
750
 
727
751
  #### Defined in
728
752
 
729
- [prelude.ts:395](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L395)
753
+ [core.ts:368](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L368)
730
754
 
731
755
  ***
732
756
 
@@ -750,4 +774,4 @@ Returns the contained `Ok` value or computes it from a closure if the result is
750
774
 
751
775
  #### Defined in
752
776
 
753
- [prelude.ts:401](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L401)
777
+ [core.ts:374](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/core.ts#L374)
@@ -7,7 +7,7 @@
7
7
  # Type Alias: AsyncIOResult\<T\>
8
8
 
9
9
  ```ts
10
- type AsyncIOResult<T>: Promise<IOResult<T>>;
10
+ type AsyncIOResult<T>: AsyncResult<T, Error>;
11
11
  ```
12
12
 
13
13
  Represents an asynchronous I/O operation that yields a `Result<T, Error>`.
@@ -21,4 +21,4 @@ This is a promise that resolves to `Ok(T)` if the I/O operation was successful,
21
21
 
22
22
  ## Defined in
23
23
 
24
- [prelude.ts:628](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L628)
24
+ [defines.ts:38](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/defines.ts#L38)
@@ -21,4 +21,4 @@ This is a promise that resolves to either `Some(T)` if the value is present, or
21
21
 
22
22
  ## Defined in
23
23
 
24
- [prelude.ts:603](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L603)
24
+ [defines.ts:13](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/defines.ts#L13)
@@ -22,4 +22,4 @@ This is a promise that resolves to `Ok(T)` if the operation was successful, or `
22
22
 
23
23
  ## Defined in
24
24
 
25
- [prelude.ts:612](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L612)
25
+ [defines.ts:22](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/defines.ts#L22)
@@ -21,4 +21,4 @@ This is a result that is either `Ok(T)` if the operation was successful, or `Err
21
21
 
22
22
  ## Defined in
23
23
 
24
- [prelude.ts:620](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L620)
24
+ [defines.ts:30](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/defines.ts#L30)
@@ -15,4 +15,4 @@ This constant is frozen to ensure it is immutable and cannot be altered, preserv
15
15
 
16
16
  ## Defined in
17
17
 
18
- [prelude.ts:286](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L286)
18
+ [prelude.ts:10](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/prelude.ts#L10)
@@ -0,0 +1,18 @@
1
+ [**happy-rusty**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [happy-rusty](../README.md) / RESULT\_FALSE
6
+
7
+ # Variable: RESULT\_FALSE
8
+
9
+ ```ts
10
+ const RESULT_FALSE: Result<boolean, any>;
11
+ ```
12
+
13
+ Result constant for `false`.
14
+ Can be used anywhere due to immutability.
15
+
16
+ ## Defined in
17
+
18
+ [constants.ts:19](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/constants.ts#L19)
@@ -0,0 +1,18 @@
1
+ [**happy-rusty**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [happy-rusty](../README.md) / RESULT\_TRUE
6
+
7
+ # Variable: RESULT\_TRUE
8
+
9
+ ```ts
10
+ const RESULT_TRUE: Result<boolean, any>;
11
+ ```
12
+
13
+ Result constant for `true`.
14
+ Can be used anywhere due to immutability.
15
+
16
+ ## Defined in
17
+
18
+ [constants.ts:13](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/constants.ts#L13)
@@ -0,0 +1,18 @@
1
+ [**happy-rusty**](../README.md) • **Docs**
2
+
3
+ ***
4
+
5
+ [happy-rusty](../README.md) / RESULT\_ZERO
6
+
7
+ # Variable: RESULT\_ZERO
8
+
9
+ ```ts
10
+ const RESULT_ZERO: Result<number, any>;
11
+ ```
12
+
13
+ Result constant for `0`.
14
+ Can be used anywhere due to immutability.
15
+
16
+ ## Defined in
17
+
18
+ [constants.ts:25](https://github.com/JiangJie/happy-rusty/blob/ba112bb228eba4376da813b0604a1f67c4b2f569/src/enum/constants.ts#L25)
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Porting some excellent design implementations from Rust to JavaScript.",
4
4
  "author": "jiang115jie@gmail.com",
5
5
  "license": "GPL-3.0",
6
- "version": "1.1.2",
6
+ "version": "1.3.0",
7
7
  "type": "module",
8
8
  "source": "src/mod.ts",
9
9
  "main": "dist/main.cjs",
@@ -21,7 +21,7 @@
21
21
  "sideEffects": false,
22
22
  "scripts": {
23
23
  "check": "pnpm exec tsc --noEmit",
24
- "lint": "pnpm exec eslint src/",
24
+ "lint": "pnpm exec eslint .",
25
25
  "prebuild": "pnpm dlx rimraf dist && pnpm run check && pnpm run lint",
26
26
  "build": "pnpm exec rollup --config rollup.config.mjs",
27
27
  "pretest": "pnpm dlx rimraf coverage",
@@ -47,15 +47,16 @@
47
47
  "Err"
48
48
  ],
49
49
  "devDependencies": {
50
- "@typescript-eslint/eslint-plugin": "^7.16.1",
51
- "@typescript-eslint/parser": "^7.16.1",
52
- "eslint": "^8.57.0",
53
- "rollup": "^4.18.1",
50
+ "@eslint/js": "^9.8.0",
51
+ "@types/eslint__js": "^8.42.3",
52
+ "eslint": "^9.8.0",
53
+ "rollup": "^4.19.2",
54
54
  "rollup-plugin-dts": "^6.1.1",
55
55
  "rollup-plugin-esbuild": "^6.1.1",
56
- "typedoc": "^0.26.4",
57
- "typedoc-plugin-markdown": "^4.2.1",
58
- "typescript": "^5.5.3"
56
+ "typedoc": "^0.26.5",
57
+ "typedoc-plugin-markdown": "^4.2.3",
58
+ "typescript": "^5.5.4",
59
+ "typescript-eslint": "^8.0.0"
59
60
  },
60
- "packageManager": "pnpm@9.5.0"
61
+ "packageManager": "pnpm@9.6.0"
61
62
  }
@@ -0,0 +1,25 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import type { Result } from './core.ts';
3
+ import { Ok } from './prelude.ts';
4
+
5
+ /**
6
+ * Exports some Result constants.
7
+ */
8
+
9
+ /**
10
+ * Result constant for `true`.
11
+ * Can be used anywhere due to immutability.
12
+ */
13
+ export const RESULT_TRUE: Result<boolean, any> = Ok(true);
14
+
15
+ /**
16
+ * Result constant for `false`.
17
+ * Can be used anywhere due to immutability.
18
+ */
19
+ export const RESULT_FALSE: Result<boolean, any> = Ok(false);
20
+
21
+ /**
22
+ * Result constant for `0`.
23
+ * Can be used anywhere due to immutability.
24
+ */
25
+ export const RESULT_ZERO: Result<number, any> = Ok(0);