Module doh::util [] [src]

Module containing various utility functions.

Structs

RaiiGuard

A RAII guard object, calling a function when it's created and when it's destroyed.

TAB_SPACING

Filler to replace tabs with of length TAB_WIDTH.

Constants

GETCH_ARROW_DOWN

Second byte returned by getch() for down arrow key.

GETCH_ARROW_LEFT

Second byte returned by getch() for left arrow key.

GETCH_ARROW_RIGHT

Second byte returned by getch() for right arrow key.

GETCH_ARROW_UP

Second byte returned by getch() for up arrow key.

GETCH_DELETE

Second byte returned by getch() for Delete.

GETCH_END

Second byte returned by getch() for End key.

GETCH_ENTER

Byte returned by getch() for Enter.

GETCH_ESC

Byte returned by getch() for Escape.

GETCH_HOME

Second byte returned by getch() for Home key.

GETCH_PAGE_DOWN

Second byte returned by getch() for Page Down key.

GETCH_PAGE_UP

Second byte returned by getch() for Page Up key.

GETCH_SPECIAL_PREFIX

First byte returned by getch() for special characters.

TAB_WIDTH

Amount of spaces to expand tabs to.

Statics

USER_AGENT

App name and version to use with User-Agent request header.

Functions

human_readable_size

Construct string representing a human-readable size.

max_listing_lines

Get max amount of listed elements per page, based on term height

parent_url

Get a URL that is canonically considered a "parent" to the specified one, or the specified URL if it is a root URL.

parse_rfc3339

Parse an RFC3339 string into a timespec.

percent_decode

Decode a percent-encoded string (like a part of a URL).