Enum shiratsu_naming::naming::tosec::TOSECToken
source · [−]pub enum TOSECToken<'a> {
Show 15 variants
Title(&'a str),
Version(&'a str, &'a str, Option<&'a str>),
Demo(Option<&'a str>),
Date(&'a str, Option<&'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 str, Option<&'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 str, Option<&'a str>)
A version flag.
Tuple elements
- The version type.
- If this is
Rev
, a space occurs between the version type and the major version.
- If this is
- The major version.
- The minor version, if any.
Demo(Option<&'a str>)
A demo flag, preceding the demo-
string.
Examples
(demo)
parses asDemo(None)
.(demo-kiosk)
parses asDemo(Some("kiosk"))
Date(&'a str, Option<&'a str>, Option<&'a str>)
Publisher(Option<Vec<&'a str>>)
A publisher flag, with publishers separated by -
if more than one.
Examples
(-)
parses asPublisher(None)
(Publisher A - Doe, John)
parses asPublisher(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
- The region strings that correspond to the parsed regions.
- 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 str, Option<&'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
- The letter or name of the dump flag.
- The number of the dump flag, if any.
- 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 asDumpInfo("!", None, None)
[f1 Fix Fixer]
parses asDumpInfo("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
- The media part name
- The number of the media part.
- The total parts of the media, if any.
Examples
(Side A)
parses toMedia(vec![("Side", "A", None)])
.(Disc 1 of 2 Side B)
parses toMedia(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
sourceimpl<'a> Clone for TOSECToken<'a>
impl<'a> Clone for TOSECToken<'a>
sourcefn clone(&self) -> TOSECToken<'a>
fn clone(&self) -> TOSECToken<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for TOSECToken<'a>
impl<'a> Debug for TOSECToken<'a>
sourceimpl<'a> Ord for TOSECToken<'a>
impl<'a> Ord for TOSECToken<'a>
sourcefn cmp(&self, other: &TOSECToken<'a>) -> Ordering
fn cmp(&self, other: &TOSECToken<'a>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<TOSECToken<'_>> for TOSECToken<'_>
impl PartialEq<TOSECToken<'_>> for TOSECToken<'_>
sourceimpl PartialOrd<TOSECToken<'_>> for TOSECToken<'_>
impl PartialOrd<TOSECToken<'_>> for TOSECToken<'_>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl<'a> TokenizedName<'a, TOSECToken<'a>> for TOSECName<'a>
impl<'a> TokenizedName<'a, TOSECToken<'a>> for TOSECName<'a>
sourcefn iter(&self) -> Iter<'_, TOSECToken<'a>>
fn iter(&self) -> Iter<'_, TOSECToken<'a>>
Returns an iterator over the tokens of this name.
sourcefn try_parse<S: AsRef<str> + ?Sized>(input: &'a S) -> Result<Self, NameError>
fn try_parse<S: AsRef<str> + ?Sized>(input: &'a S) -> Result<Self, NameError>
Tries to parse the input string using the naming convention of this tokenized name. Read more
sourcefn naming_convention() -> NamingConvention
fn naming_convention() -> NamingConvention
The naming convention of this tokenized name.
impl<'a> Eq for TOSECToken<'a>
impl<'a> StructuralEq for TOSECToken<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for TOSECToken<'a>
impl<'a> Send for TOSECToken<'a>
impl<'a> Sync for TOSECToken<'a>
impl<'a> Unpin for TOSECToken<'a>
impl<'a> UnwindSafe for TOSECToken<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.