pub enum TOSECToken<'a> {
Show 15 variants Title(&'a str), Version(&'a str, &'a strOption<&'a str>), Demo(Option<&'a str>), Date(&'a strOption<&'a str>, Option<&'a str>), Publisher(Option<Vec<&'a str>>), System(&'a str), Video(&'a str), Region(Vec<&'a str>, Vec<Region>), Languages(TOSECLanguage<'a>), Copyright(&'a str), Development(&'a str), DumpInfo(&'a strOption<&'a str>, Option<&'a str>), Media(Vec<(&'a str, &'a str, Option<&'a str>)>), Flag(FlagType, &'a str), Warning(TOSECWarn<'a>),
}
Expand description

A token constituent within a TOSECToken.

Tokens are not guaranteed to have consistent semantics outside of a NoIntroName. The order of tokens in a TOSECName is significant in order of appearance in the input file name.

TOSECToken has a custom implementation of PartialOrd following the TOSEC Naming Convention.

Variants

Title(&'a str)

The title of the ROM.

Version(&'a str, &'a strOption<&'a str>)

A version flag.

Tuple elements
  1. The version type.
    • If this is Rev, a space occurs between the version type and the major version.
  2. The major version.
  3. The minor version, if any.

Demo(Option<&'a str>)

A demo flag, preceding the demo- string.

Examples
  • (demo) parses as Demo(None).
  • (demo-kiosk) parses as Demo(Some("kiosk"))

Date(&'a strOption<&'a str>, Option<&'a str>)

A date flag

Tuple elements
  1. The year.
  2. The month, if any.
  3. The day, if any.

Publisher(Option<Vec<&'a str>>)

A publisher flag, with publishers separated by - if more than one.

Examples
  • (-) parses as Publisher(None)
  • (Publisher A - Doe, John) parses as Publisher(Some(vec!["Publisher A", "Doe, John"]))

System(&'a str)

A system flag.

See the TOSEC Naming Convention for a list of valid system flags.

Video(&'a str)

A video flag.

See the TOSEC Naming Convention for a list of valid video flags.

Region(Vec<&'a str>, Vec<Region>)

The region of the ROM.

Because of the existence of GoodTools region codes in ZZZ-UNK- ROMs, you may not assume a one-to-one correspondence between the strings in the region flag, and the list of parsed regions, since GoodTools regions may go through expansion.

Tuple elements
  1. The region strings that correspond to the parsed regions.
  2. The parsed regions.

Languages(TOSECLanguage<'a>)

A language flag.

See the TOSECLanguage documentation for more details.

Copyright(&'a str)

A copyright status flag.

See the TOSEC Naming Convention for a list of valid copyright status flags.

Development(&'a str)

A development status flag.

See the TOSEC Naming Convention for a list of valid development status flags.

DumpInfo(&'a strOption<&'a str>, Option<&'a str>)

A dump info flag.

[more info]’ flags are parsed as Flag(FlagType::Bracketed, &'a str), and not DumpInfo.

See the TOSEC Naming Convention for a list of valid dump info flags.

Tuple elements
  1. The letter or name of the dump flag.
  2. The number of the dump flag, if any.
  3. The arguments or additional information of the dump flag, if any. This is an opaque string, and is not specialized with the type of the dump flag.
Example
  • [!] parses as DumpInfo("!", None, None)
  • [f1 Fix Fixer] parses as DumpInfo("f", Some("1"), Some("Fix Fixer")

Media(Vec<(&'a str, &'a str, Option<&'a str>)>)

A media part number flag.

There may be multiple media parts in a flag, separated by a space.

Media type flags are parsed as Flag(FlagType::Parenthesized, &'a str), and not Media.

Tuple elements
  1. The media part name
  2. The number of the media part.
  3. The total parts of the media, if any.
Examples
  • (Side A) parses to Media(vec![("Side", "A", None)]).
  • (Disc 1 of 2 Side B) parses to Media(vec[("Disc", "1", Some("2")), ("Side", "B", None)]).

Flag(FlagType, &'a str)

A generic, non-defined, or unknown flag.

Warning(TOSECWarn<'a>)

Indicates an unexpected deviations from the TOSEC Naming convention.

Warnings may be lexical (appearing in the input string) or non-lexical, depending on the warning.

Warnings are always associated with the token following the warning in the resulting TOSECName token stream.

This also means that lexical warnings occur in the order of appearance in the input string.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Get the title of the tokenized name.

Returns an iterator over the tokens of this name.

Tries to parse the input string using the naming convention of this tokenized name. Read more

The naming convention of this tokenized name.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.