happy-rusty 1.1.0 → 1.1.2

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.
@@ -1,8 +1,8 @@
1
- [**happy-rusty**](../index.md) • **Docs**
1
+ [**happy-rusty**](../README.md) • **Docs**
2
2
 
3
3
  ***
4
4
 
5
- [happy-rusty](../index.md) / Result
5
+ [happy-rusty](../README.md) / Result
6
6
 
7
7
  # Interface: Result\<T, E\>
8
8
 
@@ -18,19 +18,13 @@ pub enum Result<T, E> {
18
18
  }
19
19
  ```
20
20
 
21
- ## Type parameters
21
+ ## Type Parameters
22
22
 
23
- | Type parameter | Description |
24
- | :------ | :------ |
23
+ | Type Parameter | Description |
24
+ | ------ | ------ |
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 | Modifier | Type | Description |
31
- | :------ | :------ | :------ | :------ |
32
- | `[resultKindSymbol]` | `private` | `"Ok"` \| `"Err"` | Identify `Ok` or `Err`. |
33
-
34
28
  ## Methods
35
29
 
36
30
  ### and()
@@ -41,16 +35,16 @@ and<U>(other): Result<U, E>
41
35
 
42
36
  Returns `this` if the result is `Err`, otherwise returns the passed `Result`.
43
37
 
44
- #### Type parameters
38
+ #### Type Parameters
45
39
 
46
- | Type parameter | Description |
47
- | :------ | :------ |
40
+ | Type Parameter | Description |
41
+ | ------ | ------ |
48
42
  | `U` | The type of the value in the other `Result`. |
49
43
 
50
44
  #### Parameters
51
45
 
52
46
  | Parameter | Type | Description |
53
- | :------ | :------ | :------ |
47
+ | ------ | ------ | ------ |
54
48
  | `other` | [`Result`](Result.md)\<`U`, `E`\> | The `Result` to return if `this` is `Ok`. |
55
49
 
56
50
  #### Returns
@@ -59,9 +53,9 @@ Returns `this` if the result is `Err`, otherwise returns the passed `Result`.
59
53
 
60
54
  The passed `Result` if `this` is `Ok`, otherwise returns `this` (which is `Err`).
61
55
 
62
- #### Source
56
+ #### Defined in
63
57
 
64
- [enum/prelude.ts:518](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L518)
58
+ [prelude.ts:516](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L516)
65
59
 
66
60
  ***
67
61
 
@@ -73,16 +67,16 @@ andThen<U>(fn): Result<U, E>
73
67
 
74
68
  Calls the provided function with the contained value if `this` is `Ok`, otherwise returns `this` as `Err`.
75
69
 
76
- #### Type parameters
70
+ #### Type Parameters
77
71
 
78
- | Type parameter | Description |
79
- | :------ | :------ |
72
+ | Type Parameter | Description |
73
+ | ------ | ------ |
80
74
  | `U` | The type of the value returned by the function. |
81
75
 
82
76
  #### Parameters
83
77
 
84
78
  | Parameter | Type | Description |
85
- | :------ | :------ | :------ |
79
+ | ------ | ------ | ------ |
86
80
  | `fn` | (`value`) => [`Result`](Result.md)\<`U`, `E`\> | A function that takes the `Ok` value and returns a `Result`. |
87
81
 
88
82
  #### Returns
@@ -91,9 +85,66 @@ Calls the provided function with the contained value if `this` is `Ok`, otherwis
91
85
 
92
86
  The result of `fn` if `this` is `Ok`, otherwise `this` as `Err`.
93
87
 
94
- #### Source
88
+ #### Defined in
89
+
90
+ [prelude.ts:532](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L532)
91
+
92
+ ***
93
+
94
+ ### asErr()
95
+
96
+ ```ts
97
+ asErr<U>(): Result<U, E>
98
+ ```
99
+
100
+ Transforms the current Result into a new Result where the type of the success result is replaced with a new type `U`.
101
+ The type of the error result remains unchanged.
102
+ Useful where you need to return an Error chained to another type.
103
+ Just same as `result as unknown as Result<U, E>`.
104
+
105
+ #### Type Parameters
106
+
107
+ | Type Parameter | Description |
108
+ | ------ | ------ |
109
+ | `U` | The new type for the success result. |
110
+
111
+ #### Returns
112
+
113
+ [`Result`](Result.md)\<`U`, `E`\>
114
+
115
+ `this` but the success result type is `U`.
116
+
117
+ #### Defined in
118
+
119
+ [prelude.ts:590](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L590)
120
+
121
+ ***
122
+
123
+ ### asOk()
124
+
125
+ ```ts
126
+ asOk<F>(): Result<T, F>
127
+ ```
128
+
129
+ Transforms the current Result into a new Result where the type of the error result is replaced with a new type `F`.
130
+ The type of the success result remains unchanged.
131
+ Just same as `result as unknown as Result<T, F>`.
132
+
133
+ #### Type Parameters
134
+
135
+ | Type Parameter | Description |
136
+ | ------ | ------ |
137
+ | `F` | The new type for the error result. |
138
+
139
+ #### Returns
140
+
141
+ [`Result`](Result.md)\<`T`, `F`\>
142
+
143
+ `this` but the error result type is `F`.
144
+
145
+ #### Defined in
95
146
 
96
- [enum/prelude.ts:534](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L534)
147
+ [prelude.ts:579](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L579)
97
148
 
98
149
  ***
99
150
 
@@ -108,7 +159,7 @@ Tests whether `this` and `other` are both `Ok` containing equal values, or both
108
159
  #### Parameters
109
160
 
110
161
  | Parameter | Type | Description |
111
- | :------ | :------ | :------ |
162
+ | ------ | ------ | ------ |
112
163
  | `other` | [`Result`](Result.md)\<`T`, `E`\> | The other `Result` to compare with. |
113
164
 
114
165
  #### Returns
@@ -117,9 +168,9 @@ Tests whether `this` and `other` are both `Ok` containing equal values, or both
117
168
 
118
169
  `true` if `this` and `other` are both `Ok` with equal values, or both are `Err` with equal errors, otherwise `false`.
119
170
 
120
- #### Source
171
+ #### Defined in
121
172
 
122
- [enum/prelude.ts:569](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L569)
173
+ [prelude.ts:567](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L567)
123
174
 
124
175
  ***
125
176
 
@@ -137,9 +188,9 @@ If the result is `Ok`, returns `None`.
137
188
 
138
189
  [`Option`](Option.md)\<`E`\>
139
190
 
140
- #### Source
191
+ #### Defined in
141
192
 
142
- [enum/prelude.ts:442](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L442)
193
+ [prelude.ts:440](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L440)
143
194
 
144
195
  ***
145
196
 
@@ -154,7 +205,7 @@ Returns the contained `Ok` value, with a provided error message if the result is
154
205
  #### Parameters
155
206
 
156
207
  | Parameter | Type | Description |
157
- | :------ | :------ | :------ |
208
+ | ------ | ------ | ------ |
158
209
  | `msg` | `string` | The error message to provide if the result is an `Err`. |
159
210
 
160
211
  #### Returns
@@ -165,9 +216,9 @@ Returns the contained `Ok` value, with a provided error message if the result is
165
216
 
166
217
  Throws an error with the provided message if the result is an `Err`.
167
218
 
168
- #### Source
219
+ #### Defined in
169
220
 
170
- [enum/prelude.ts:385](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L385)
221
+ [prelude.ts:383](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L383)
171
222
 
172
223
  ***
173
224
 
@@ -182,7 +233,7 @@ Returns the contained `Err` value, with a provided error message if the result i
182
233
  #### Parameters
183
234
 
184
235
  | Parameter | Type | Description |
185
- | :------ | :------ | :------ |
236
+ | ------ | ------ | ------ |
186
237
  | `msg` | `string` | The error message to provide if the result is an `Ok`. |
187
238
 
188
239
  #### Returns
@@ -193,9 +244,9 @@ Returns the contained `Err` value, with a provided error message if the result i
193
244
 
194
245
  Throws an error with the provided message if the result is an `Ok`.
195
246
 
196
- #### Source
247
+ #### Defined in
197
248
 
198
- [enum/prelude.ts:414](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L414)
249
+ [prelude.ts:412](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L412)
199
250
 
200
251
  ***
201
252
 
@@ -209,25 +260,25 @@ Converts from `Result<Result<T, E>, E>` to `Result<T, E>`.
209
260
  If the result is `Ok(Ok(T))`, returns `Ok(T)`.
210
261
  If the result is `Ok(Err(E))` or `Err(E)`, returns `Err(E)`.
211
262
 
212
- #### Type parameters
263
+ #### Type Parameters
213
264
 
214
- | Type parameter |
215
- | :------ |
265
+ | Type Parameter |
266
+ | ------ |
216
267
  | `T` |
217
268
 
218
269
  #### Parameters
219
270
 
220
271
  | Parameter | Type |
221
- | :------ | :------ |
272
+ | ------ | ------ |
222
273
  | `this` | [`Result`](Result.md)\<[`Result`](Result.md)\<`T`, `E`\>, `E`\> |
223
274
 
224
275
  #### Returns
225
276
 
226
277
  [`Result`](Result.md)\<`T`, `E`\>
227
278
 
228
- #### Source
279
+ #### Defined in
229
280
 
230
- [enum/prelude.ts:502](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L502)
281
+ [prelude.ts:500](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L500)
231
282
 
232
283
  ***
233
284
 
@@ -243,7 +294,7 @@ Does not modify the `Result`.
243
294
  #### Parameters
244
295
 
245
296
  | Parameter | Type | Description |
246
- | :------ | :------ | :------ |
297
+ | ------ | ------ | ------ |
247
298
  | `fn` | (`value`) => `void` | A function to call with the `Ok` value. |
248
299
 
249
300
  #### Returns
@@ -252,9 +303,9 @@ Does not modify the `Result`.
252
303
 
253
304
  `this`, unmodified.
254
305
 
255
- #### Source
306
+ #### Defined in
256
307
 
257
- [enum/prelude.ts:552](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L552)
308
+ [prelude.ts:550](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L550)
258
309
 
259
310
  ***
260
311
 
@@ -270,7 +321,7 @@ Does not modify the `Result`.
270
321
  #### Parameters
271
322
 
272
323
  | Parameter | Type | Description |
273
- | :------ | :------ | :------ |
324
+ | ------ | ------ | ------ |
274
325
  | `fn` | (`error`) => `void` | A function to call with the `Err` value. |
275
326
 
276
327
  #### Returns
@@ -279,9 +330,9 @@ Does not modify the `Result`.
279
330
 
280
331
  `this`, unmodified.
281
332
 
282
- #### Source
333
+ #### Defined in
283
334
 
284
- [enum/prelude.ts:560](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L560)
335
+ [prelude.ts:558](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L558)
285
336
 
286
337
  ***
287
338
 
@@ -297,9 +348,9 @@ Returns `true` if the result is `Err`.
297
348
 
298
349
  `boolean`
299
350
 
300
- #### Source
351
+ #### Defined in
301
352
 
302
- [enum/prelude.ts:358](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L358)
353
+ [prelude.ts:356](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L356)
303
354
 
304
355
  ***
305
356
 
@@ -314,16 +365,16 @@ Returns `true` if the result is `Err` and the provided predicate returns `true`
314
365
  #### Parameters
315
366
 
316
367
  | Parameter | Type | Description |
317
- | :------ | :------ | :------ |
368
+ | ------ | ------ | ------ |
318
369
  | `predicate` | (`error`) => `boolean` | A function that takes the `Err` value and returns a boolean. |
319
370
 
320
371
  #### Returns
321
372
 
322
373
  `boolean`
323
374
 
324
- #### Source
375
+ #### Defined in
325
376
 
326
- [enum/prelude.ts:370](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L370)
377
+ [prelude.ts:368](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L368)
327
378
 
328
379
  ***
329
380
 
@@ -339,9 +390,9 @@ Returns `true` if the result is `Ok`.
339
390
 
340
391
  `boolean`
341
392
 
342
- #### Source
393
+ #### Defined in
343
394
 
344
- [enum/prelude.ts:353](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L353)
395
+ [prelude.ts:351](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L351)
345
396
 
346
397
  ***
347
398
 
@@ -356,16 +407,16 @@ Returns `true` if the result is `Ok` and the provided predicate returns `true` f
356
407
  #### Parameters
357
408
 
358
409
  | Parameter | Type | Description |
359
- | :------ | :------ | :------ |
410
+ | ------ | ------ | ------ |
360
411
  | `predicate` | (`value`) => `boolean` | A function that takes the `Ok` value and returns a boolean. |
361
412
 
362
413
  #### Returns
363
414
 
364
415
  `boolean`
365
416
 
366
- #### Source
417
+ #### Defined in
367
418
 
368
- [enum/prelude.ts:364](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L364)
419
+ [prelude.ts:362](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L362)
369
420
 
370
421
  ***
371
422
 
@@ -378,25 +429,25 @@ map<U>(fn): Result<U, E>
378
429
  Maps a `Result<T, E>` to `Result<U, E>` by applying a function to a contained `Ok` value,
379
430
  leaving an `Err` value untouched.
380
431
 
381
- #### Type parameters
432
+ #### Type Parameters
382
433
 
383
- | Type parameter | Description |
384
- | :------ | :------ |
434
+ | Type Parameter | Description |
435
+ | ------ | ------ |
385
436
  | `U` | The type of the value returned by the map function. |
386
437
 
387
438
  #### Parameters
388
439
 
389
440
  | Parameter | Type | Description |
390
- | :------ | :------ | :------ |
441
+ | ------ | ------ | ------ |
391
442
  | `fn` | (`value`) => `U` | A function that takes the `Ok` value and returns a new value. |
392
443
 
393
444
  #### Returns
394
445
 
395
446
  [`Result`](Result.md)\<`U`, `E`\>
396
447
 
397
- #### Source
448
+ #### Defined in
398
449
 
399
- [enum/prelude.ts:463](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L463)
450
+ [prelude.ts:461](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L461)
400
451
 
401
452
  ***
402
453
 
@@ -409,25 +460,25 @@ mapErr<F>(fn): Result<T, F>
409
460
  Maps a `Result<T, E>` to `Result<T, F>` by applying a function to a contained `Err` value,
410
461
  leaving an `Ok` value untouched.
411
462
 
412
- #### Type parameters
463
+ #### Type Parameters
413
464
 
414
- | Type parameter | Description |
415
- | :------ | :------ |
465
+ | Type Parameter | Description |
466
+ | ------ | ------ |
416
467
  | `F` | The type of the error returned by the map function. |
417
468
 
418
469
  #### Parameters
419
470
 
420
471
  | Parameter | Type | Description |
421
- | :------ | :------ | :------ |
472
+ | ------ | ------ | ------ |
422
473
  | `fn` | (`error`) => `F` | A function that takes the `Err` value and returns a new error value. |
423
474
 
424
475
  #### Returns
425
476
 
426
477
  [`Result`](Result.md)\<`T`, `F`\>
427
478
 
428
- #### Source
479
+ #### Defined in
429
480
 
430
- [enum/prelude.ts:475](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L475)
481
+ [prelude.ts:473](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L473)
431
482
 
432
483
  ***
433
484
 
@@ -439,16 +490,16 @@ mapOr<U>(defaultValue, fn): U
439
490
 
440
491
  Maps a `Result<T, E>` to `U` by applying a function to the contained `Ok` value (if `Ok`), or returns the provided default (if `Err`).
441
492
 
442
- #### Type parameters
493
+ #### Type Parameters
443
494
 
444
- | Type parameter | Description |
445
- | :------ | :------ |
495
+ | Type Parameter | Description |
496
+ | ------ | ------ |
446
497
  | `U` | The type of the value returned by the map function or the default value. |
447
498
 
448
499
  #### Parameters
449
500
 
450
501
  | Parameter | Type | Description |
451
- | :------ | :------ | :------ |
502
+ | ------ | ------ | ------ |
452
503
  | `defaultValue` | `U` | The value to return if the result is `Err`. |
453
504
  | `fn` | (`value`) => `U` | A function that takes the `Ok` value and returns a new value. |
454
505
 
@@ -456,9 +507,9 @@ Maps a `Result<T, E>` to `U` by applying a function to the contained `Ok` value
456
507
 
457
508
  `U`
458
509
 
459
- #### Source
510
+ #### Defined in
460
511
 
461
- [enum/prelude.ts:487](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L487)
512
+ [prelude.ts:485](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L485)
462
513
 
463
514
  ***
464
515
 
@@ -470,16 +521,16 @@ mapOrElse<U>(defaultFn, fn): U
470
521
 
471
522
  Maps a `Result<T, E>` to `U` by applying a function to the contained `Ok` value (if `Ok`), or computes a default (if `Err`).
472
523
 
473
- #### Type parameters
524
+ #### Type Parameters
474
525
 
475
- | Type parameter | Description |
476
- | :------ | :------ |
526
+ | Type Parameter | Description |
527
+ | ------ | ------ |
477
528
  | `U` | The type of the value returned by the map function or the default function. |
478
529
 
479
530
  #### Parameters
480
531
 
481
532
  | Parameter | Type | Description |
482
- | :------ | :------ | :------ |
533
+ | ------ | ------ | ------ |
483
534
  | `defaultFn` | (`error`) => `U` | A function that returns the default value. |
484
535
  | `fn` | (`value`) => `U` | A function that takes the `Ok` value and returns a new value. |
485
536
 
@@ -487,9 +538,9 @@ Maps a `Result<T, E>` to `U` by applying a function to the contained `Ok` value
487
538
 
488
539
  `U`
489
540
 
490
- #### Source
541
+ #### Defined in
491
542
 
492
- [enum/prelude.ts:495](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L495)
543
+ [prelude.ts:493](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L493)
493
544
 
494
545
  ***
495
546
 
@@ -507,9 +558,9 @@ If the result is `Err`, returns `None`.
507
558
 
508
559
  [`Option`](Option.md)\<`T`\>
509
560
 
510
- #### Source
561
+ #### Defined in
511
562
 
512
- [enum/prelude.ts:435](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L435)
563
+ [prelude.ts:433](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L433)
513
564
 
514
565
  ***
515
566
 
@@ -521,16 +572,16 @@ or<F>(other): Result<T, F>
521
572
 
522
573
  Returns `this` if it is `Ok`, otherwise returns the passed `Result`.
523
574
 
524
- #### Type parameters
575
+ #### Type Parameters
525
576
 
526
- | Type parameter | Description |
527
- | :------ | :------ |
577
+ | Type Parameter | Description |
578
+ | ------ | ------ |
528
579
  | `F` | The type of the error in the other `Result`. |
529
580
 
530
581
  #### Parameters
531
582
 
532
583
  | Parameter | Type | Description |
533
- | :------ | :------ | :------ |
584
+ | ------ | ------ | ------ |
534
585
  | `other` | [`Result`](Result.md)\<`T`, `F`\> | The `Result` to return if `this` is `Err`. |
535
586
 
536
587
  #### Returns
@@ -539,9 +590,9 @@ Returns `this` if it is `Ok`, otherwise returns the passed `Result`.
539
590
 
540
591
  `this` if it is `Ok`, otherwise returns `other`.
541
592
 
542
- #### Source
593
+ #### Defined in
543
594
 
544
- [enum/prelude.ts:526](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L526)
595
+ [prelude.ts:524](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L524)
545
596
 
546
597
  ***
547
598
 
@@ -553,16 +604,16 @@ orElse<F>(fn): Result<T, F>
553
604
 
554
605
  Calls the provided function with the contained error if `this` is `Err`, otherwise returns `this` as `Ok`.
555
606
 
556
- #### Type parameters
607
+ #### Type Parameters
557
608
 
558
- | Type parameter | Description |
559
- | :------ | :------ |
609
+ | Type Parameter | Description |
610
+ | ------ | ------ |
560
611
  | `F` | The type of the error returned by the function. |
561
612
 
562
613
  #### Parameters
563
614
 
564
615
  | Parameter | Type | Description |
565
- | :------ | :------ | :------ |
616
+ | ------ | ------ | ------ |
566
617
  | `fn` | (`error`) => [`Result`](Result.md)\<`T`, `F`\> | A function that takes the `Err` value and returns a `Result`. |
567
618
 
568
619
  #### Returns
@@ -571,9 +622,9 @@ Calls the provided function with the contained error if `this` is `Err`, otherwi
571
622
 
572
623
  The result of `fn` if `this` is `Err`, otherwise `this` as `Ok`.
573
624
 
574
- #### Source
625
+ #### Defined in
575
626
 
576
- [enum/prelude.ts:542](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L542)
627
+ [prelude.ts:540](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L540)
577
628
 
578
629
  ***
579
630
 
@@ -585,16 +636,16 @@ transpose<T>(this): Option<Result<T, E>>
585
636
 
586
637
  Transposes a `Result` of an `Option` into an `Option` of a `Result`.
587
638
 
588
- #### Type parameters
639
+ #### Type Parameters
589
640
 
590
- | Type parameter | Description |
591
- | :------ | :------ |
641
+ | Type Parameter | Description |
642
+ | ------ | ------ |
592
643
  | `T` | The type of the success value in the `Ok` variant of the `Option`. |
593
644
 
594
645
  #### Parameters
595
646
 
596
647
  | Parameter | Type |
597
- | :------ | :------ |
648
+ | ------ | ------ |
598
649
  | `this` | [`Result`](Result.md)\<[`Option`](Option.md)\<`T`\>, `E`\> |
599
650
 
600
651
  #### Returns
@@ -605,9 +656,9 @@ Transposes a `Result` of an `Option` into an `Option` of a `Result`.
605
656
  `Some` containing `Err` if the result is `Err`,
606
657
  `None` if the result is `Ok` containing `None`.
607
658
 
608
- #### Source
659
+ #### Defined in
609
660
 
610
- [enum/prelude.ts:451](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L451)
661
+ [prelude.ts:449](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L449)
611
662
 
612
663
  ***
613
664
 
@@ -627,9 +678,9 @@ Returns the contained `Ok` value.
627
678
 
628
679
  Throws an error if the result is an `Err`.
629
680
 
630
- #### Source
681
+ #### Defined in
631
682
 
632
- [enum/prelude.ts:391](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L391)
683
+ [prelude.ts:389](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L389)
633
684
 
634
685
  ***
635
686
 
@@ -649,9 +700,9 @@ Returns the contained `Err` value.
649
700
 
650
701
  Throws an error if the result is an `Ok`.
651
702
 
652
- #### Source
703
+ #### Defined in
653
704
 
654
- [enum/prelude.ts:420](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L420)
705
+ [prelude.ts:418](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L418)
655
706
 
656
707
  ***
657
708
 
@@ -666,16 +717,16 @@ Returns the contained `Ok` value or a provided default.
666
717
  #### Parameters
667
718
 
668
719
  | Parameter | Type | Description |
669
- | :------ | :------ | :------ |
720
+ | ------ | ------ | ------ |
670
721
  | `defaultValue` | `T` | The value to return if the result is an `Err`. |
671
722
 
672
723
  #### Returns
673
724
 
674
725
  `T`
675
726
 
676
- #### Source
727
+ #### Defined in
677
728
 
678
- [enum/prelude.ts:397](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L397)
729
+ [prelude.ts:395](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L395)
679
730
 
680
731
  ***
681
732
 
@@ -690,13 +741,13 @@ Returns the contained `Ok` value or computes it from a closure if the result is
690
741
  #### Parameters
691
742
 
692
743
  | Parameter | Type | Description |
693
- | :------ | :------ | :------ |
744
+ | ------ | ------ | ------ |
694
745
  | `fn` | (`error`) => `T` | A function that takes the `Err` value and returns an `Ok` value. |
695
746
 
696
747
  #### Returns
697
748
 
698
749
  `T`
699
750
 
700
- #### Source
751
+ #### Defined in
701
752
 
702
- [enum/prelude.ts:403](https://github.com/JiangJie/happy-rusty/blob/15ed105e08c6cc3943e22243c9386336a521d83e/src/enum/prelude.ts#L403)
753
+ [prelude.ts:401](https://github.com/JiangJie/happy-rusty/blob/7218a182717eb5dbba4bfaf783977bc5e378815a/src/enum/prelude.ts#L401)