format::ini
format::ini provides a parser for DOS-style INI files:
# This is a comment
[harelang.org]
name=Hare
description=The Hare programming language
[blablabla]
key=value
# Unicode
trademark=™
Index
Types
type entry = (const str, const str, const str);
type scanner = struct {
scan: bufio::scanner,
lineno: size,
section: str,
};
Errors
type error = !(io::error | utf8::invalid | syntaxerr);
type syntaxerr = !size;
Functions
fn entry_dup(ent: entry) entry;
fn entry_finish(ent: entry) void;
fn finish(sc: *scanner) void;
fn next(sc: *scanner) (entry | io::EOF | error);
fn scan(in: io::handle) scanner;
fn strerror(err: error) const str;
Types
type entry
type entry = (const str, const str, const str);
An entry in an INI file: (section, key, value).
type scanner
Show undocumented member
type scanner = struct {
scan: bufio::scanner,
lineno: size,
section: str,
};
Errors
type error
type error = !(io::error | utf8::invalid | syntaxerr);
Any error that may occur during parsing.
type syntaxerr
type syntaxerr = !size;
A syntax error occurred during parsing.
Functions
fn entry_dup
fn entry_dup(ent: entry) entry;
Duplicates an entry. Use entry_finish to get rid of it.
fn entry_finish
fn entry_finish(ent: entry) void;
Frees an entry previously duplicated with entry_dup.
fn finish
fn finish(sc: *scanner) void;
Frees resources associated with a scanner.
fn next
fn next(sc: *scanner) (entry | io::EOF | error);
Returns the next entry from an INI file. The return value is borrowed from the scanner. Use entry_dup to retain a copy.
fn scan
fn scan(in: io::handle) scanner;
Creates an INI file scanner. Use next to read entries. The caller must call finish once they're done with this object.
fn strerror
fn strerror(err: error) const str;
Returns a user-friendly representation of error. The result may be statically allocated.