Rill v0.13 Reference

Standard library

The standard library

43 modules, all written in Rill, imported by their path under lib/: import "data/json" as json. The compiler finds them beside its own bin/ in a packaged toolchain, or through RILL_PATH. These pages are what rill doc lib writes: the comment above each declaration, and the signature the checker infers for it.

Text lib/text

  1. fmttext/fmtText laid out and numbers spelled: a template with slots, padding by width, a float to so many places, thousands separated, a size in bytes, an ordinal, a table with its columns lined up.
  2. pathtext/pathFile paths as text: joining, taking apart, tidying.
  3. regextext/regexRegular expressions: a small backtracking matcher, written in Rill.
  4. strtext/strStrings, past what the prelude gives.

Data formats lib/data

  1. checksumdata/checksumThe two checksums a file format is likely to ask for: CRC-32 (IEEE 802.3, the one in zip, gzip and PNG) and Adler-32 (zlib's).
  2. csvdata/csvCSV, read and written, as RFC 4180 has it: a field is quoted when it holds the separator, a quote, or a line break; a quote inside a quoted field is doubled; a line ends in \n or \r\n.
  3. deflatedata/deflatest holds the position in the data, the bits read but not yet used, how many of them there are, and whether the data ran out.
  4. jsondata/jsonJSON, written in Rill: a recursive-descent parser and a printer.
  5. yamldata/yamlWhat is left to read, and the value read so far.

Collections lib/coll

  1. dequecoll/dequeA queue with both ends open: push and pop at the front or the back, each in constant time on average.
  2. heapcoll/heapA priority queue: the least element is always at the top, and taking it costs a logarithm.
  3. setcoll/setA set of values: a hash table with only keys, so membership is a lookup rather than a walk.

Numbers lib/num

  1. bigintnum/bigintIntegers of any size, written in Rill.
  2. colnum/colColumn aggregates, vectorized by hand.
  3. decimalnum/decimalDecimal numbers with a fixed number of places: money, and anything else where 0.1 + 0.2 has to be 0.3.
  4. gridnum/gridgrid — arrays of numbers with a shape, the way NumPy has them.

The web lib/web

  1. formweb/formThe fields, by the content type: pairs become parts with no file name and no type.
  2. httpweb/httpA small HTTP/1.1 server, written in Rill on top of the socket builtins.
  3. mimeweb/mimeThe media type a file is served as, from its name: mime.of_path("a/b.png") is image/png.
  4. tlsweb/tlsA connection: the OpenSSL object, its context, and the socket under it.
  5. tmplweb/tmplThe runtime half of the template engine: what a generated template calls.
  6. urlweb/urlURLs taken apart and put together (RFC 3986): the scheme, who, the host, the port, the path, the query, the fragment; a query as pairs; a relative reference resolved against a base; percent-encoding both ways.
  7. wsweb/wsWebSocket (RFC 6455) on top of the socket builtins: the handshake, and text or binary frames in both directions.

The network lib/net

  1. dnsnet/dnsEvery address the name has, IPv4 addresses first and then IPv6, or why there are none.
  2. udpnet/udpA socket bound to port on every interface; 0 for one the system picks.

Databases lib/db

  1. kvdb/kvA key–value store on disk: a B+ tree of 4 KB pages, a page cache, and a write-ahead log — the shape SQLite's file layer has, in Rill, for one process at a time.
  2. oxidbdb/oxidbOne request, one reply, unwrapped into a Result.
  3. oxirecdb/oxirecOne basket: who it was, what was in it, and when.
  4. oxirespdb/oxirespA client for OxiDB's in-memory key-value engine, written in Rill.
  5. oxisqldb/oxisql? in the text takes the next value from params, which is how a value reaches the engine without being written into the statement.
  6. oxitsdbdb/oxitsdbEvery request names the engine as well as the command: the server mounts the time-series engine beside the document and SQL ones, and engine is what tells them apart.
  7. oxiwiredb/oxiwireAnswers a Parsed — the JSON module's, so a frame that will not decode travels out the same way a document that will not parse does.

The command line lib/cli

  1. argscli/argsCommand-line arguments: what a program takes, said once, and then parsed, checked and explained from that one saying.
  2. envcli/envThe variable's value, or None when it is not set.
  3. logcli/logThe level from the RILL_LOG variable — debug, info, warn, error, or off — and info when it is unset or says something else.
  4. proccli/procThe exit code and what the command wrote.

Cryptography lib/crypto

  1. passwdcrypto/passwdHMAC-SHA-1.
  2. sha1crypto/sha1SHA-1 and base64, written in Rill.
  3. sha2crypto/sha2The digest, as 32 raw bytes.

Randomness lib/random

  1. rndrandom/rndRandom numbers, from a generator that is a value.
  2. uuidrandom/uuidUUIDs (RFC 9562): the random kind, version 4, and the time-ordered kind, version 7, whose first 48 bits are the millisecond it was made, so a column of them sorts by when.

Time lib/time

  1. clocktime/clockClocks: the monotonic one for measuring, the wall one for dating.
  2. datetime/dateCivil dates and times, in UTC and nothing else.