Skip to main content

Module menu

Module menu 

Source
Expand description

Gopher menu parser — RFC 1436 menus into a typed item list.

A gopher menu is tab-delimited lines: <type><display>\t<selector>\t<host> \t<port>. The first character is the item type; a bare . terminates the menu. This parser classifies each line into a GopherItem carrying the item GopherKind (so a native viewer can show a per-type affordance) plus the resolved resource URL (synthesised per RFC 4266, or extracted for a URL item). Info and error lines carry no URL. A consumer decides how to present each kind; the parser holds no document or render model.

This module has no dependencies and is compiled unconditionally, so a consumer that only renders menus can take the crate with default-features = false.

References: RFC 1436 (Gopher), RFC 4266 (gopher URI scheme).

Structs§

GopherItem
One parsed gopher menu line.

Enums§

GopherKind
The semantic class of a gopher menu line, from its item-type character.
GopherPlus
The Gopher+ marker carried in an item line’s fifth field.

Functions§

parse
Parse a gopher menu body into items, in source order. Stops at the RFC 1436 . terminator; skips blank and malformed lines (a non-info/error item with no host, or a URL item with no target).