happy-rusty 1.3.2 → 1.4.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/dist/main.cjs +2 -0
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +2 -1
- package/dist/main.mjs.map +1 -1
- package/dist/types.d.ts +29 -1
- package/docs/README.md +5 -0
- package/docs/functions/Err.md +1 -1
- package/docs/functions/Ok.md +30 -6
- package/docs/functions/Some.md +1 -1
- package/docs/functions/isOption.md +1 -1
- package/docs/functions/isResult.md +1 -1
- package/docs/functions/promiseToAsyncResult.md +1 -1
- package/docs/interfaces/None.md +28 -28
- package/docs/interfaces/Option.md +27 -27
- package/docs/interfaces/Result.md +29 -29
- package/docs/type-aliases/AsyncIOResult.md +1 -1
- package/docs/type-aliases/AsyncOption.md +1 -1
- package/docs/type-aliases/AsyncResult.md +1 -1
- package/docs/type-aliases/AsyncVoidIOResult.md +17 -0
- package/docs/type-aliases/AsyncVoidResult.md +23 -0
- package/docs/type-aliases/IOResult.md +1 -1
- package/docs/type-aliases/VoidIOResult.md +17 -0
- package/docs/type-aliases/VoidResult.md +23 -0
- package/docs/variables/None.md +1 -1
- package/docs/variables/RESULT_FALSE.md +1 -1
- package/docs/variables/RESULT_TRUE.md +1 -1
- package/docs/variables/RESULT_VOID.md +17 -0
- package/docs/variables/RESULT_ZERO.md +1 -1
- package/package.json +1 -1
- package/src/enum/constants.ts +6 -1
- package/src/enum/defines.ts +25 -1
- package/src/enum/prelude.ts +18 -13
package/docs/interfaces/None.md
CHANGED
|
@@ -17,8 +17,8 @@ The type parameter is set to `never` because `None` does not hold a value.
|
|
|
17
17
|
|
|
18
18
|
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|
|
19
19
|
| ------ | ------ | ------ | ------ | ------ | ------ | ------ |
|
|
20
|
-
| `[OptionKindSymbol]` | `readonly` | `"None"` | When using `None` alone, the following overrides can make type inference more accurate. | `Option.[OptionKindSymbol]` | - | [prelude.ts:15](https://github.com/JiangJie/happy-rusty/blob/
|
|
21
|
-
| `[toStringTag]` | `public` | `"Option"` | [object Option]. | - | [`Option`](Option.md).`[toStringTag]` | [core.ts:30](https://github.com/JiangJie/happy-rusty/blob/
|
|
20
|
+
| `[OptionKindSymbol]` | `readonly` | `"None"` | When using `None` alone, the following overrides can make type inference more accurate. | `Option.[OptionKindSymbol]` | - | [prelude.ts:15](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L15) |
|
|
21
|
+
| `[toStringTag]` | `public` | `"Option"` | [object Option]. | - | [`Option`](Option.md).`[toStringTag]` | [core.ts:30](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L30) |
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
@@ -55,7 +55,7 @@ This is sometimes called "and then" because it is similar to a logical AND opera
|
|
|
55
55
|
|
|
56
56
|
#### Defined in
|
|
57
57
|
|
|
58
|
-
[prelude.ts:30](https://github.com/JiangJie/happy-rusty/blob/
|
|
58
|
+
[prelude.ts:30](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L30)
|
|
59
59
|
|
|
60
60
|
***
|
|
61
61
|
|
|
@@ -92,7 +92,7 @@ The result of `fn` if `this` is `Some`, otherwise `None`.
|
|
|
92
92
|
|
|
93
93
|
#### Defined in
|
|
94
94
|
|
|
95
|
-
[prelude.ts:31](https://github.com/JiangJie/happy-rusty/blob/
|
|
95
|
+
[prelude.ts:31](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L31)
|
|
96
96
|
|
|
97
97
|
***
|
|
98
98
|
|
|
@@ -129,7 +129,7 @@ This method can be used for comparing `Option` instances in a value-sensitive ma
|
|
|
129
129
|
|
|
130
130
|
#### Defined in
|
|
131
131
|
|
|
132
|
-
[prelude.ts:36](https://github.com/JiangJie/happy-rusty/blob/
|
|
132
|
+
[prelude.ts:36](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L36)
|
|
133
133
|
|
|
134
134
|
***
|
|
135
135
|
|
|
@@ -161,7 +161,7 @@ Throws an error with the provided message if the Option is a `None`.
|
|
|
161
161
|
|
|
162
162
|
#### Defined in
|
|
163
163
|
|
|
164
|
-
[core.ts:76](https://github.com/JiangJie/happy-rusty/blob/
|
|
164
|
+
[core.ts:76](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L76)
|
|
165
165
|
|
|
166
166
|
***
|
|
167
167
|
|
|
@@ -191,7 +191,7 @@ Returns `None` if the Option is `None`, otherwise calls predicate with the wrapp
|
|
|
191
191
|
|
|
192
192
|
#### Defined in
|
|
193
193
|
|
|
194
|
-
[prelude.ts:22](https://github.com/JiangJie/happy-rusty/blob/
|
|
194
|
+
[prelude.ts:22](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L22)
|
|
195
195
|
|
|
196
196
|
***
|
|
197
197
|
|
|
@@ -215,7 +215,7 @@ Converts from `Option<Option<T>>` to `Option<T>`.
|
|
|
215
215
|
|
|
216
216
|
#### Defined in
|
|
217
217
|
|
|
218
|
-
[prelude.ts:23](https://github.com/JiangJie/happy-rusty/blob/
|
|
218
|
+
[prelude.ts:23](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L23)
|
|
219
219
|
|
|
220
220
|
***
|
|
221
221
|
|
|
@@ -246,7 +246,7 @@ This is primarily for side effects and does not transform the `Option`.
|
|
|
246
246
|
|
|
247
247
|
#### Defined in
|
|
248
248
|
|
|
249
|
-
[core.ts:263](https://github.com/JiangJie/happy-rusty/blob/
|
|
249
|
+
[core.ts:263](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L263)
|
|
250
250
|
|
|
251
251
|
***
|
|
252
252
|
|
|
@@ -268,7 +268,7 @@ Returns `true` if the Option is a `None` value.
|
|
|
268
268
|
|
|
269
269
|
#### Defined in
|
|
270
270
|
|
|
271
|
-
[core.ts:55](https://github.com/JiangJie/happy-rusty/blob/
|
|
271
|
+
[core.ts:55](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L55)
|
|
272
272
|
|
|
273
273
|
***
|
|
274
274
|
|
|
@@ -290,7 +290,7 @@ Returns `true` if the Option is a `Some` value.
|
|
|
290
290
|
|
|
291
291
|
#### Defined in
|
|
292
292
|
|
|
293
|
-
[core.ts:50](https://github.com/JiangJie/happy-rusty/blob/
|
|
293
|
+
[core.ts:50](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L50)
|
|
294
294
|
|
|
295
295
|
***
|
|
296
296
|
|
|
@@ -318,7 +318,7 @@ Returns `true` if the Option is a `Some` value and the predicate returns `true`
|
|
|
318
318
|
|
|
319
319
|
#### Defined in
|
|
320
320
|
|
|
321
|
-
[core.ts:61](https://github.com/JiangJie/happy-rusty/blob/
|
|
321
|
+
[core.ts:61](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L61)
|
|
322
322
|
|
|
323
323
|
***
|
|
324
324
|
|
|
@@ -352,7 +352,7 @@ Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.
|
|
|
352
352
|
|
|
353
353
|
#### Defined in
|
|
354
354
|
|
|
355
|
-
[prelude.ts:24](https://github.com/JiangJie/happy-rusty/blob/
|
|
355
|
+
[prelude.ts:24](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L24)
|
|
356
356
|
|
|
357
357
|
***
|
|
358
358
|
|
|
@@ -387,7 +387,7 @@ Maps an `Option<T>` to `U` by applying a function to the contained value (if any
|
|
|
387
387
|
|
|
388
388
|
#### Defined in
|
|
389
389
|
|
|
390
|
-
[core.ts:159](https://github.com/JiangJie/happy-rusty/blob/
|
|
390
|
+
[core.ts:159](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L159)
|
|
391
391
|
|
|
392
392
|
***
|
|
393
393
|
|
|
@@ -422,7 +422,7 @@ Maps an `Option<T>` to `U` by applying a function to a contained value (if any),
|
|
|
422
422
|
|
|
423
423
|
#### Defined in
|
|
424
424
|
|
|
425
|
-
[core.ts:167](https://github.com/JiangJie/happy-rusty/blob/
|
|
425
|
+
[core.ts:167](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L167)
|
|
426
426
|
|
|
427
427
|
***
|
|
428
428
|
|
|
@@ -456,7 +456,7 @@ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` a
|
|
|
456
456
|
|
|
457
457
|
#### Defined in
|
|
458
458
|
|
|
459
|
-
[core.ts:109](https://github.com/JiangJie/happy-rusty/blob/
|
|
459
|
+
[core.ts:109](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L109)
|
|
460
460
|
|
|
461
461
|
***
|
|
462
462
|
|
|
@@ -490,7 +490,7 @@ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` a
|
|
|
490
490
|
|
|
491
491
|
#### Defined in
|
|
492
492
|
|
|
493
|
-
[core.ts:116](https://github.com/JiangJie/happy-rusty/blob/
|
|
493
|
+
[core.ts:116](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L116)
|
|
494
494
|
|
|
495
495
|
***
|
|
496
496
|
|
|
@@ -527,7 +527,7 @@ This can be used for providing a fallback `Option`.
|
|
|
527
527
|
|
|
528
528
|
#### Defined in
|
|
529
529
|
|
|
530
|
-
[prelude.ts:32](https://github.com/JiangJie/happy-rusty/blob/
|
|
530
|
+
[prelude.ts:32](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L32)
|
|
531
531
|
|
|
532
532
|
***
|
|
533
533
|
|
|
@@ -564,7 +564,7 @@ This method can be used for lazy fallbacks, as `fn` is only evaluated if `this`
|
|
|
564
564
|
|
|
565
565
|
#### Defined in
|
|
566
566
|
|
|
567
|
-
[prelude.ts:33](https://github.com/JiangJie/happy-rusty/blob/
|
|
567
|
+
[prelude.ts:33](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L33)
|
|
568
568
|
|
|
569
569
|
***
|
|
570
570
|
|
|
@@ -586,7 +586,7 @@ Custom `toString` implementation that uses the `Option`'s contained value.
|
|
|
586
586
|
|
|
587
587
|
#### Defined in
|
|
588
588
|
|
|
589
|
-
[core.ts:280](https://github.com/JiangJie/happy-rusty/blob/
|
|
589
|
+
[core.ts:280](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L280)
|
|
590
590
|
|
|
591
591
|
***
|
|
592
592
|
|
|
@@ -612,7 +612,7 @@ Transposes an `Option` of a `Result` into a `Result` of an `Option`.
|
|
|
612
612
|
|
|
613
613
|
#### Defined in
|
|
614
614
|
|
|
615
|
-
[prelude.ts:20](https://github.com/JiangJie/happy-rusty/blob/
|
|
615
|
+
[prelude.ts:20](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L20)
|
|
616
616
|
|
|
617
617
|
***
|
|
618
618
|
|
|
@@ -638,7 +638,7 @@ Throws an error if the value is a `None`.
|
|
|
638
638
|
|
|
639
639
|
#### Defined in
|
|
640
640
|
|
|
641
|
-
[core.ts:82](https://github.com/JiangJie/happy-rusty/blob/
|
|
641
|
+
[core.ts:82](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L82)
|
|
642
642
|
|
|
643
643
|
***
|
|
644
644
|
|
|
@@ -672,7 +672,7 @@ Returns the contained `Some` value or a provided default.
|
|
|
672
672
|
|
|
673
673
|
#### Defined in
|
|
674
674
|
|
|
675
|
-
[prelude.ts:17](https://github.com/JiangJie/happy-rusty/blob/
|
|
675
|
+
[prelude.ts:17](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L17)
|
|
676
676
|
|
|
677
677
|
***
|
|
678
678
|
|
|
@@ -706,7 +706,7 @@ Returns the contained `Some` value or computes it from a closure.
|
|
|
706
706
|
|
|
707
707
|
#### Defined in
|
|
708
708
|
|
|
709
|
-
[prelude.ts:18](https://github.com/JiangJie/happy-rusty/blob/
|
|
709
|
+
[prelude.ts:18](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L18)
|
|
710
710
|
|
|
711
711
|
***
|
|
712
712
|
|
|
@@ -732,7 +732,7 @@ A tuple of `Options`, one for each element in the original `Option` of a tuple.
|
|
|
732
732
|
|
|
733
733
|
#### Defined in
|
|
734
734
|
|
|
735
|
-
[prelude.ts:28](https://github.com/JiangJie/happy-rusty/blob/
|
|
735
|
+
[prelude.ts:28](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L28)
|
|
736
736
|
|
|
737
737
|
***
|
|
738
738
|
|
|
@@ -769,7 +769,7 @@ This can be thought of as an exclusive or operation on `Option` values.
|
|
|
769
769
|
|
|
770
770
|
#### Defined in
|
|
771
771
|
|
|
772
|
-
[prelude.ts:34](https://github.com/JiangJie/happy-rusty/blob/
|
|
772
|
+
[prelude.ts:34](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L34)
|
|
773
773
|
|
|
774
774
|
***
|
|
775
775
|
|
|
@@ -807,7 +807,7 @@ An `Option` containing a tuple of the values if both are `Some`, otherwise `None
|
|
|
807
807
|
|
|
808
808
|
#### Defined in
|
|
809
809
|
|
|
810
|
-
[prelude.ts:26](https://github.com/JiangJie/happy-rusty/blob/
|
|
810
|
+
[prelude.ts:26](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L26)
|
|
811
811
|
|
|
812
812
|
***
|
|
813
813
|
|
|
@@ -847,4 +847,4 @@ An `Option` containing the result of `fn` if both `Options` are `Some`, otherwis
|
|
|
847
847
|
|
|
848
848
|
#### Defined in
|
|
849
849
|
|
|
850
|
-
[prelude.ts:27](https://github.com/JiangJie/happy-rusty/blob/
|
|
850
|
+
[prelude.ts:27](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/prelude.ts#L27)
|
|
@@ -31,7 +31,7 @@ pub enum Option<T> {
|
|
|
31
31
|
|
|
32
32
|
| Property | Type | Description | Defined in |
|
|
33
33
|
| ------ | ------ | ------ | ------ |
|
|
34
|
-
| `[toStringTag]` | `"Option"` | [object Option]. | [core.ts:30](https://github.com/JiangJie/happy-rusty/blob/
|
|
34
|
+
| `[toStringTag]` | `"Option"` | [object Option]. | [core.ts:30](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L30) |
|
|
35
35
|
|
|
36
36
|
## Methods
|
|
37
37
|
|
|
@@ -64,7 +64,7 @@ This is sometimes called "and then" because it is similar to a logical AND opera
|
|
|
64
64
|
|
|
65
65
|
#### Defined in
|
|
66
66
|
|
|
67
|
-
[core.ts:220](https://github.com/JiangJie/happy-rusty/blob/
|
|
67
|
+
[core.ts:220](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L220)
|
|
68
68
|
|
|
69
69
|
***
|
|
70
70
|
|
|
@@ -97,7 +97,7 @@ The result of `fn` if `this` is `Some`, otherwise `None`.
|
|
|
97
97
|
|
|
98
98
|
#### Defined in
|
|
99
99
|
|
|
100
|
-
[core.ts:229](https://github.com/JiangJie/happy-rusty/blob/
|
|
100
|
+
[core.ts:229](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L229)
|
|
101
101
|
|
|
102
102
|
***
|
|
103
103
|
|
|
@@ -124,7 +124,7 @@ This method can be used for comparing `Option` instances in a value-sensitive ma
|
|
|
124
124
|
|
|
125
125
|
#### Defined in
|
|
126
126
|
|
|
127
|
-
[core.ts:273](https://github.com/JiangJie/happy-rusty/blob/
|
|
127
|
+
[core.ts:273](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L273)
|
|
128
128
|
|
|
129
129
|
***
|
|
130
130
|
|
|
@@ -152,7 +152,7 @@ Throws an error with the provided message if the Option is a `None`.
|
|
|
152
152
|
|
|
153
153
|
#### Defined in
|
|
154
154
|
|
|
155
|
-
[core.ts:76](https://github.com/JiangJie/happy-rusty/blob/
|
|
155
|
+
[core.ts:76](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L76)
|
|
156
156
|
|
|
157
157
|
***
|
|
158
158
|
|
|
@@ -178,7 +178,7 @@ Returns `None` if the Option is `None`, otherwise calls predicate with the wrapp
|
|
|
178
178
|
|
|
179
179
|
#### Defined in
|
|
180
180
|
|
|
181
|
-
[core.ts:138](https://github.com/JiangJie/happy-rusty/blob/
|
|
181
|
+
[core.ts:138](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L138)
|
|
182
182
|
|
|
183
183
|
***
|
|
184
184
|
|
|
@@ -210,7 +210,7 @@ Converts from `Option<Option<T>>` to `Option<T>`.
|
|
|
210
210
|
|
|
211
211
|
#### Defined in
|
|
212
212
|
|
|
213
|
-
[core.ts:144](https://github.com/JiangJie/happy-rusty/blob/
|
|
213
|
+
[core.ts:144](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L144)
|
|
214
214
|
|
|
215
215
|
***
|
|
216
216
|
|
|
@@ -237,7 +237,7 @@ This is primarily for side effects and does not transform the `Option`.
|
|
|
237
237
|
|
|
238
238
|
#### Defined in
|
|
239
239
|
|
|
240
|
-
[core.ts:263](https://github.com/JiangJie/happy-rusty/blob/
|
|
240
|
+
[core.ts:263](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L263)
|
|
241
241
|
|
|
242
242
|
***
|
|
243
243
|
|
|
@@ -255,7 +255,7 @@ Returns `true` if the Option is a `None` value.
|
|
|
255
255
|
|
|
256
256
|
#### Defined in
|
|
257
257
|
|
|
258
|
-
[core.ts:55](https://github.com/JiangJie/happy-rusty/blob/
|
|
258
|
+
[core.ts:55](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L55)
|
|
259
259
|
|
|
260
260
|
***
|
|
261
261
|
|
|
@@ -273,7 +273,7 @@ Returns `true` if the Option is a `Some` value.
|
|
|
273
273
|
|
|
274
274
|
#### Defined in
|
|
275
275
|
|
|
276
|
-
[core.ts:50](https://github.com/JiangJie/happy-rusty/blob/
|
|
276
|
+
[core.ts:50](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L50)
|
|
277
277
|
|
|
278
278
|
***
|
|
279
279
|
|
|
@@ -297,7 +297,7 @@ Returns `true` if the Option is a `Some` value and the predicate returns `true`
|
|
|
297
297
|
|
|
298
298
|
#### Defined in
|
|
299
299
|
|
|
300
|
-
[core.ts:61](https://github.com/JiangJie/happy-rusty/blob/
|
|
300
|
+
[core.ts:61](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L61)
|
|
301
301
|
|
|
302
302
|
***
|
|
303
303
|
|
|
@@ -327,7 +327,7 @@ Maps an `Option<T>` to `Option<U>` by applying a function to a contained value.
|
|
|
327
327
|
|
|
328
328
|
#### Defined in
|
|
329
329
|
|
|
330
|
-
[core.ts:151](https://github.com/JiangJie/happy-rusty/blob/
|
|
330
|
+
[core.ts:151](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L151)
|
|
331
331
|
|
|
332
332
|
***
|
|
333
333
|
|
|
@@ -358,7 +358,7 @@ Maps an `Option<T>` to `U` by applying a function to the contained value (if any
|
|
|
358
358
|
|
|
359
359
|
#### Defined in
|
|
360
360
|
|
|
361
|
-
[core.ts:159](https://github.com/JiangJie/happy-rusty/blob/
|
|
361
|
+
[core.ts:159](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L159)
|
|
362
362
|
|
|
363
363
|
***
|
|
364
364
|
|
|
@@ -389,7 +389,7 @@ Maps an `Option<T>` to `U` by applying a function to a contained value (if any),
|
|
|
389
389
|
|
|
390
390
|
#### Defined in
|
|
391
391
|
|
|
392
|
-
[core.ts:167](https://github.com/JiangJie/happy-rusty/blob/
|
|
392
|
+
[core.ts:167](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L167)
|
|
393
393
|
|
|
394
394
|
***
|
|
395
395
|
|
|
@@ -419,7 +419,7 @@ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` a
|
|
|
419
419
|
|
|
420
420
|
#### Defined in
|
|
421
421
|
|
|
422
|
-
[core.ts:109](https://github.com/JiangJie/happy-rusty/blob/
|
|
422
|
+
[core.ts:109](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L109)
|
|
423
423
|
|
|
424
424
|
***
|
|
425
425
|
|
|
@@ -449,7 +449,7 @@ Transforms the `Option<T>` into a `Result<T, E>`, mapping `Some(v)` to `Ok(v)` a
|
|
|
449
449
|
|
|
450
450
|
#### Defined in
|
|
451
451
|
|
|
452
|
-
[core.ts:116](https://github.com/JiangJie/happy-rusty/blob/
|
|
452
|
+
[core.ts:116](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L116)
|
|
453
453
|
|
|
454
454
|
***
|
|
455
455
|
|
|
@@ -476,7 +476,7 @@ This can be used for providing a fallback `Option`.
|
|
|
476
476
|
|
|
477
477
|
#### Defined in
|
|
478
478
|
|
|
479
|
-
[core.ts:237](https://github.com/JiangJie/happy-rusty/blob/
|
|
479
|
+
[core.ts:237](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L237)
|
|
480
480
|
|
|
481
481
|
***
|
|
482
482
|
|
|
@@ -503,7 +503,7 @@ This method can be used for lazy fallbacks, as `fn` is only evaluated if `this`
|
|
|
503
503
|
|
|
504
504
|
#### Defined in
|
|
505
505
|
|
|
506
|
-
[core.ts:245](https://github.com/JiangJie/happy-rusty/blob/
|
|
506
|
+
[core.ts:245](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L245)
|
|
507
507
|
|
|
508
508
|
***
|
|
509
509
|
|
|
@@ -521,7 +521,7 @@ Custom `toString` implementation that uses the `Option`'s contained value.
|
|
|
521
521
|
|
|
522
522
|
#### Defined in
|
|
523
523
|
|
|
524
|
-
[core.ts:280](https://github.com/JiangJie/happy-rusty/blob/
|
|
524
|
+
[core.ts:280](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L280)
|
|
525
525
|
|
|
526
526
|
***
|
|
527
527
|
|
|
@@ -556,7 +556,7 @@ Transposes an `Option` of a `Result` into a `Result` of an `Option`.
|
|
|
556
556
|
|
|
557
557
|
#### Defined in
|
|
558
558
|
|
|
559
|
-
[core.ts:126](https://github.com/JiangJie/happy-rusty/blob/
|
|
559
|
+
[core.ts:126](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L126)
|
|
560
560
|
|
|
561
561
|
***
|
|
562
562
|
|
|
@@ -578,7 +578,7 @@ Throws an error if the value is a `None`.
|
|
|
578
578
|
|
|
579
579
|
#### Defined in
|
|
580
580
|
|
|
581
|
-
[core.ts:82](https://github.com/JiangJie/happy-rusty/blob/
|
|
581
|
+
[core.ts:82](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L82)
|
|
582
582
|
|
|
583
583
|
***
|
|
584
584
|
|
|
@@ -602,7 +602,7 @@ Returns the contained `Some` value or a provided default.
|
|
|
602
602
|
|
|
603
603
|
#### Defined in
|
|
604
604
|
|
|
605
|
-
[core.ts:88](https://github.com/JiangJie/happy-rusty/blob/
|
|
605
|
+
[core.ts:88](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L88)
|
|
606
606
|
|
|
607
607
|
***
|
|
608
608
|
|
|
@@ -626,7 +626,7 @@ Returns the contained `Some` value or computes it from a closure.
|
|
|
626
626
|
|
|
627
627
|
#### Defined in
|
|
628
628
|
|
|
629
|
-
[core.ts:94](https://github.com/JiangJie/happy-rusty/blob/
|
|
629
|
+
[core.ts:94](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L94)
|
|
630
630
|
|
|
631
631
|
***
|
|
632
632
|
|
|
@@ -661,7 +661,7 @@ A tuple of `Options`, one for each element in the original `Option` of a tuple.
|
|
|
661
661
|
|
|
662
662
|
#### Defined in
|
|
663
663
|
|
|
664
|
-
[core.ts:203](https://github.com/JiangJie/happy-rusty/blob/
|
|
664
|
+
[core.ts:203](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L203)
|
|
665
665
|
|
|
666
666
|
***
|
|
667
667
|
|
|
@@ -688,7 +688,7 @@ This can be thought of as an exclusive or operation on `Option` values.
|
|
|
688
688
|
|
|
689
689
|
#### Defined in
|
|
690
690
|
|
|
691
|
-
[core.ts:253](https://github.com/JiangJie/happy-rusty/blob/
|
|
691
|
+
[core.ts:253](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L253)
|
|
692
692
|
|
|
693
693
|
***
|
|
694
694
|
|
|
@@ -722,7 +722,7 @@ An `Option` containing a tuple of the values if both are `Some`, otherwise `None
|
|
|
722
722
|
|
|
723
723
|
#### Defined in
|
|
724
724
|
|
|
725
|
-
[core.ts:181](https://github.com/JiangJie/happy-rusty/blob/
|
|
725
|
+
[core.ts:181](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L181)
|
|
726
726
|
|
|
727
727
|
***
|
|
728
728
|
|
|
@@ -758,4 +758,4 @@ An `Option` containing the result of `fn` if both `Options` are `Some`, otherwis
|
|
|
758
758
|
|
|
759
759
|
#### Defined in
|
|
760
760
|
|
|
761
|
-
[core.ts:193](https://github.com/JiangJie/happy-rusty/blob/
|
|
761
|
+
[core.ts:193](https://github.com/JiangJie/happy-rusty/blob/7d7f4ab2132e507f77594d030495f95b5688b84a/src/enum/core.ts#L193)
|