package async

  1. Overview
  2. Docs
type t
val create : ?config:Config.t -> max_message_size:int -> Async_unix.Fd.t -> t
val transport_reader : t -> transport_reader
val peek_bin_prot : t -> 'a Core.Bin_prot.Type_class.reader -> ('a, [ `Closed | `Eof ]) Core.Result.t Async_kernel.Deferred.t
val peek_once_without_buffering_from_socket : t -> len:int -> (Core.Bigstring.t, [ `Closed | `Not_enough_data ]) Core.Result.t Async_kernel.Deferred.t

peek_once_without_buffering_from_socket peeks len from t's underlying fd. The fd *must* be a socket. It doesn't pull in any bytes, from the socket, into the transport's internal buffer. After peek_available_without_buffering_from_socket is complete, any other code that reads from the socket will see the bytes that were peeked here.

It doesn't wait for len number of bytes to appear; hence _once_ in the name. As soon as there's any data available on the socket, it tries to peek len bytes. If the available bytes is less than len then it returns `Not_enough_data.