Skip to content

Commit 803c96f

Browse files
committed
Update TypeUtils.hx
1 parent 0bf9b15 commit 803c96f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

source/yutautil/TypeUtils.hx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,14 +1696,18 @@ abstract Assertion(() -> Bool) {
16961696
}
16971697

16981698
/**
1699-
* Result<T, E> is an abstract type representing either a successful result of type T or an error of type E.
1700-
* It can be implicitly cast to T, but will throw an error if the Result is an error.
1699+
* ResultData is a private enum used internally by the Result abstract type.
1700+
* It has two constructors: Ok(value:T) for successful results and Err(error:E) for errors.
17011701
*/
17021702
private enum ResultData<T, E> {
17031703
Ok(value:T);
17041704
Err(error:E);
17051705
}
17061706

1707+
/**
1708+
* Result<T, E> is an abstract type representing either a successful result of type T or an error of type E.
1709+
* It can be implicitly cast to T, but will throw an error if the Result is an error.
1710+
*/
17071711
abstract Result<T, E>(ResultData<T, E>) {
17081712
public inline function new(value:ResultData<T, E>) {
17091713
this = value;
@@ -1757,7 +1761,7 @@ abstract Result<T, E>(ResultData<T, E>) {
17571761
}
17581762

17591763
public inline function unwrap():T {
1760-
return this;
1764+
return cast this;
17611765
}
17621766

17631767
public inline function unwrapErr():E {

0 commit comments

Comments
 (0)