Module parser

Source
Expand description

Parsing flags from text.

Format and parse a flags value as text using the following grammar:

  • Flags: (Whitespace Flag Whitespace)|*
  • Flag: Name | Hex Number
  • Name: The name of any defined flag
  • Hex Number: 0x([0-9a-fA-F])*
  • Whitespace: (\s)*

As an example, this is how Flags::A | Flags::B | 0x0c can be represented as text:

A | B | 0x0c

Alternatively, it could be represented without whitespace:

A|B|0x0C

Note that identifiers are case-sensitive, so the following is not equivalent:

a|b|0x0C

Structs§

ParseError
An error encountered while parsing flags from text.

Traits§

ParseHex
Parse a value from a hex string.
WriteHex
Encode a value as a hex string.

Functions§

from_str
Parse a flags value from text.
from_str_strict
Parse a flags value from text.
from_str_truncate
Parse a flags value from text.
to_writer
Write a flags value as text.
to_writer_strict
Write only the contained, defined, named flags in a flags value as text.
to_writer_truncate
Write a flags value as text, ignoring any unknown bits.