On this page:
Port.Pipe
Port.Pipe.make
Port.Pipe.content_  length
8.15.0.12

13.5 Pipes🔗ℹ

A Rhombus pipe is internal to Rhombus (and Racket), and not related to OS-level pipes for communicating between different processes.

annotation

Port.Pipe

Regonizes pipes created with Port.Pipe.make.

function

fun Port.Pipe.make(

  ~limit: maybe(PosInt),

  ~input_name: input_name :: Any = #'pipe,

  ~input_name: output_name :: Any = #'pipe

) :: values(Port.Input && Port.Pipe,

            Port.Output && Port.Pipe)

Returns two port values: the first port is an input port and the second is an output port. Data written to the output port is read from the input port, with no intermediate buffering. Unlike some other kinds of ports, pipe ports do not need to be explicitly closed to be reclaimed by garbage collection.

If limit is #false, the new pipe holds an unlimited number of unread bytes (i.e., limited only by the available memory). If limit is a positive number, then the pipe will hold at most limit unread/unpeeked bytes; writing to the pipe’s output port thereafter will block until a read or peek from the input port makes more space available. (Peeks effectively extend the port’s capacity until the peeked bytes are read.)

The optional input_name and outputname) are used as the names for the returned input and output ports, respectively.

Returns the number of bytes contained in a pipe, where port is either of the pipe’s ports produced by Port.Pipe.make. The pipe’s content length counts all bytes that have been written to the pipe and not yet read (though possibly peeked).