mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
add Fut.is_done
This commit is contained in:
parent
f18ed688e9
commit
f76b713556
2 changed files with 9 additions and 0 deletions
|
|
@ -28,6 +28,11 @@ let[@inline] peek self : _ option =
|
|||
| Done x -> Some x
|
||||
| Waiting _ -> None
|
||||
|
||||
let[@inline] is_done self : bool =
|
||||
match A.get self.st with
|
||||
| Done _ -> true
|
||||
| Waiting _ -> false
|
||||
|
||||
exception Not_ready
|
||||
|
||||
let[@inline] get_or_fail self =
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ val get_or_fail_exn : 'a t -> 'a
|
|||
@raise Not_ready if the future is not ready.
|
||||
@since 0.2 *)
|
||||
|
||||
val is_done : _ t -> bool
|
||||
(** Is the future resolved? This is the same as [peek fut |> Option.is_some].
|
||||
@since 0.2 *)
|
||||
|
||||
(** {2 Combinators} *)
|
||||
|
||||
val spawn : on:Pool.t -> (unit -> 'a) -> 'a t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue