From 0b6fc00eacff022242391269e73ebcbe2483e31e Mon Sep 17 00:00:00 2001 From: Simon Grondin Date: Fri, 23 Jun 2023 07:33:50 -0500 Subject: [PATCH] Eio: use functions instead of direct methods --- benchmarks/eio_benchmark.ml | 2 +- eio/angstrom_eio.ml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/eio_benchmark.ml b/benchmarks/eio_benchmark.ml index 63ded66..55a09aa 100644 --- a/benchmarks/eio_benchmark.ml +++ b/benchmarks/eio_benchmark.ml @@ -8,7 +8,7 @@ let main env = | "json" -> Angstrom.(RFC7159.json >>| fun x -> `Json x) | _ -> print_endline "usage: eio_json_benchmark.native PARSER"; exit 1 in - Angstrom_eio.parse_many parser toss env#stdin + Angstrom_eio.parse_many parser toss (Eio.Stdenv.stdin env) |> function | _, Ok () -> () | _, Error err -> failwith err diff --git a/eio/angstrom_eio.ml b/eio/angstrom_eio.ml index ac570c8..cbc397f 100644 --- a/eio/angstrom_eio.ml +++ b/eio/angstrom_eio.ml @@ -53,7 +53,7 @@ let parse ?(pushback = default_pushback) parser src = | (Fail _ as state) -> handle_parse_result state | Partial feed as state -> ( - match src#read_into buf with + match Eio.Flow.single_read src buf with | 0 | (exception End_of_file) -> finalize state |> handle_parse_result @@ -68,7 +68,7 @@ let rec buffered_state_loop pushback state src (buf : Cstruct.t) = match state with | Partial k -> let next = - match src#read_into buf with + match Eio.Flow.single_read src buf with | 0 | (exception End_of_file) -> k `Eof