result tag
This commit is contained in:
parent
5c75da4736
commit
4bf5f33f25
|
@ -16,3 +16,16 @@ let getValue = (r: result_<'a, 'e>): option<'a> =>
|
|||
| Ok(v) => Some(v)
|
||||
| Error(_) => None
|
||||
}
|
||||
|
||||
@module("ForTS_Result_tag") @scope("ResultTag")
|
||||
external rtOk_: int = "RtOk"
|
||||
|
||||
@module("ForTS_Result_tag") @scope("ResultTag")
|
||||
external rtError_: int = "RtError"
|
||||
|
||||
@genType
|
||||
let getTag = (r: result_<'a, 'e>): int =>
|
||||
switch r {
|
||||
| Ok(_) => rtOk_
|
||||
| Error(_) => rtError_
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
enum ResultTag {
|
||||
Ok,
|
||||
Error,
|
||||
}
|
Loading…
Reference in New Issue
Block a user