Markus Mottl avatar Markus Mottl committed ac5722f

Fixed Writer.write_marshal function

Comments (0)

Files changed (2)

base/async/unix/lib/writer.ml

   val write_bin_prot : t -> 'a Bin_prot.Type_class.writer -> 'a -> unit
 end)
 
-let write_marshal () =
-  Or_error.map Bigstring_marshal.marshal ~f:(fun marshal t ~flags a ->
-    schedule_unscheduled t `Keep;
-    let iovec = IOVec.of_bigstring (marshal ~flags a) in
-    add_iovec t `Destroy iovec ~count_bytes_as_received:true;
-    maybe_start_writer t)
+let write_marshal t ~flags v =
+  schedule_unscheduled t `Keep;
+  let iovec = IOVec.of_bigstring (Bigstring_marshal.marshal ~flags v) in
+  add_iovec t `Destroy iovec ~count_bytes_as_received:true;
+  maybe_start_writer t
 ;;
 
 let send t s =
   ensure_not_closed t; schedule_bigstring t ?pos ?len bstr
 let write ?pos ?len t s       = ensure_not_closed t; write ?pos ?len t s
 let writef t                  = ensure_not_closed t; writef t
-let write_marshal () =
-  Or_error.map (write_marshal ()) ~f:(fun write_marshal t ~flags a ->
-    ensure_not_closed t; write_marshal t ~flags a)
-;;
+let write_marshal t ~flags v  = ensure_not_closed t; write_marshal t ~flags v
 let write_sexp ?hum t s       = ensure_not_closed t; write_sexp ?hum t s
 let write_bigsubstring t s    = ensure_not_closed t; write_bigsubstring t s
 let write_substring t s       = ensure_not_closed t; write_substring t s

base/async/unix/lib/writer.mli

     before the data itself.  This is the format that Reader.read_bin_prot reads. *)
 val write_bin_prot : t -> 'a Bin_prot.Type_class.writer -> 'a -> unit
 
-(** serialize data using marshal and write it to the writer
-
-    The [Or_error] is because it may not be implemented on some platforms.
-    The [unit -> ] is to allow polymorphism. *)
-val write_marshal
-  : unit -> (t -> flags:Marshal.extern_flags list -> 'a -> unit) Or_error.t
+(** Serialize data using marshal and write it to the writer *)
+val write_marshal : t -> flags : Marshal.extern_flags list -> 'a -> unit
 
 (** Unlike the [write_] functions, all functions starting with [schedule_] require
     flushing or closing of the writer after returning before it is safe to modify the
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.