Expand description
Connection object builtins — file connections, stdin/stdout/stderr, TCP sockets.
R connections wrap file handles (or other I/O sources) behind integer IDs.
This module provides: file(), open(), close(), isOpen(),
readLines()/writeLines() connection dispatch, the three standard stream
constructors stdin(), stdout(), stderr(), and TCP client socket
builtins: make.socket(), read.socket(), write.socket(), close.socket().
Connection metadata lives on the Interpreter struct as a Vec<ConnectionInfo>.
Slots 0-2 are pre-allocated for stdin, stdout, and stderr.
TCP streams (std::net::TcpStream) are not Clone, so they are stored
separately in a HashMap<usize, TcpStream> keyed by connection ID.
Structs§
- Connection
Info - Describes a single connection slot in the interpreter.
Enums§
- Connection
Kind - Discriminates what kind of I/O backing a connection has.
Statics§
- __
INTERP_ 🔒REG_ INTERP_ CLOSE - __
INTERP_ 🔒REG_ INTERP_ CLOSE_ SOCKET - __
INTERP_ 🔒REG_ INTERP_ FILE - __
INTERP_ 🔒REG_ INTERP_ IS_ OPEN - __
INTERP_ 🔒REG_ INTERP_ MAKE_ SOCKET - __
INTERP_ 🔒REG_ INTERP_ OPEN - __
INTERP_ 🔒REG_ INTERP_ READ_ LINES - __
INTERP_ 🔒REG_ INTERP_ READ_ SOCKET - __
INTERP_ 🔒REG_ INTERP_ STDERR - __
INTERP_ 🔒REG_ INTERP_ STDIN - __
INTERP_ 🔒REG_ INTERP_ STDOUT - __
INTERP_ 🔒REG_ INTERP_ WRITE_ LINES - __
INTERP_ 🔒REG_ INTERP_ WRITE_ SOCKET
Functions§
- connection_
id 🔒 - Extract a connection ID from an argument that is either an integer (possibly with class “connection”) or a double that can be losslessly converted.
- connection_
value 🔒 - Build an integer scalar with class
"connection"representing connectionid. - interp_
close 🔒 - Close a connection or progress bar.
- interp_
close_ 🔒socket - Close a TCP socket connection.
- interp_
file 🔒 - Create a file connection.
- interp_
is_ 🔒open - Test whether a connection is open.
- interp_
make_ 🔒socket - Create a TCP client socket connection.
- interp_
open 🔒 - Open a connection.
- interp_
read_ 🔒lines - Read text lines from a file path or a connection.
- interp_
read_ 🔒socket - Read up to
maxlenbytes from a TCP socket connection. - interp_
stderr 🔒 - Return connection 2 (standard error).
- interp_
stdin 🔒 - Return connection 0 (standard input).
- interp_
stdout 🔒 - Return connection 1 (standard output).
- interp_
write_ 🔒lines - Write text lines to a file path, connection, or stdout.
- interp_
write_ 🔒socket - Write a string to a TCP socket connection.
- is_
connection 🔒 - Returns
trueifvalcarries the"connection"class attribute. - resolved_
path_ 🔒string