compat for Result

This commit is contained in:
Simon Cruanes 2022-06-09 11:28:26 -04:00
parent 5d3fa1c8eb
commit 7fd56bb5c3
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -6,6 +6,12 @@ module Lock = Lock
module Rand_bytes = Rand_bytes module Rand_bytes = Rand_bytes
(** Generation of random identifiers *) (** Generation of random identifiers *)
open struct
let result_bind x f = match x with
| Error e -> Error e
| Ok x -> f x
end
(** {2 Wire format} *) (** {2 Wire format} *)
(** Protobuf types *) (** Protobuf types *)
@ -913,7 +919,7 @@ module Trace_context = struct
[{flags}] are currently ignored. [{flags}] are currently ignored.
*) *)
let of_value str : (Trace_id.t * Span_id.t, string) result = let of_value str : (Trace_id.t * Span_id.t, string) result =
let ( let* ) = Result.bind in let ( let* ) = result_bind in
let blit ~offset ~len ~or_ = let blit ~offset ~len ~or_ =
let buf = Bytes.create len in let buf = Bytes.create len in
let* str = let* str =