Skip to main content

Module syntax

Module syntax 

Source
Expand description

Syntax definitions for identifiers.

This module contains traits that are needed to define an identifier. It also contains reasonable default implementations of these traits for certain obvious cases.

  • Boundary defines how chunks are broken during segmentation (if at all).
  • Delimiter defines the kinds of characters that always delimit a chunk regardless of the boundary.
  • Profile defines a subset of the set of all valid UTF-8 characters that are valid for an identifier.

To aide in automatic zero-cost casting, a special type named SubsetOf, which can dictate that one syntax element is a subset of another. This powers the Ident::cast function, which checks at compile-time if it’s safe and trivial to just cast from one identifier to another.

For more details, see the respective documentation for each item.

Modules§

boundary
Syntax definitions for how chunks (runs of non-delimiter characters) should be broken up during segmentation.
delimiter
Syntax definitions for identifier chunk delimiters.
profile
Syntax definitions for chunk character profiles.
segmentation
Syntax definitions for segmentation strategies.

Traits§

Boundary
Defines how chunks are split during segmentation.
CasedProfile
A trait which further distinguishes a profile as an adapter of another base profile, with some new casing rules mixed in.
CharProfile
A marker trait that declares a type to be a character profile specifically (as opposed to an adapted profile).
Delimiter
A trait for signifying that a type can be used as a delimiter in an identifier.
Profile
Defines the valid composition of characters for a chunk (a slice of an identifier that contains no delimiters).
Segmentation
A trait which contains type definitions for segmentation iterators.
SubsetOf
A type that suggests that one syntax rule is the subset of another.
UnitDelimiter
A trait that should be implemented when a delimiter has exactly one value, and that value is valid at any position of the identifier.