Module phile::util [] [src]

The util module provides various useful helper functions, types and macros, used extensively throughout the PHiLe source tree. Generic reference-counted smart pointers, string manipulation specific to the syntax of PHiLe, and commonly-used constants are all part of this file.

Structs

Diagnostic

A string which, when Displayed, looks pretty and colorful. It is used for formatting diagnostic messages.

PackageInfo

Type of a global descriptor that holds information about the current version of the PHiLe package (library and compiler). The purpose of a global instance of this struct is to provide user-readable version information in a uniform manner throughout the code base, and for potential 3rd-party tooling.

RcCell

A reference counted, dynamically borrow checked smart pointer. Like Rc<RefCell<T>>, but with a more convenient interface.

WkCell

Weak counterpart of RcCell<T>.

Enums

DiagnosticKind

Used for distinguishing between the types of diagnostic that the compiler can emit.

Statics

PACKAGE_INFO

Holds metadata about the PHiLe package as defined in the Cargo manifest.

Traits

SkipN

Extends iterators with the skip_n() function.

Functions

grapheme_count

Returns the number of extended grapheme clusters in string. Useful for counting 'characters' in accordance with a user's notion of a 'character' or grapheme. Mainly used by the lexer for generating visually accurate source location data.

grapheme_count_by

Counts the grapheme clusters in a string that satisfy a condition.