#[repr(transparent)]pub struct TOSECName<'a>(_);
Expand description
A TOSEC format file name.
The order of tokens in a
TOSECName
is significant in order of appearance in the input file name.
They are also not guaranteed to be strictly conforming to the
TOSEC naming convention, but can be made so
using TOSECName::into_strict()
.
Implementations
sourceimpl TOSECName<'_>
impl TOSECName<'_>
sourcepub fn without_trailing(self) -> Self
pub fn without_trailing(self) -> Self
Removes any trailing unparsed string segments from the name.
sourcepub fn into_strict(self) -> Self
pub fn into_strict(self) -> Self
Makes the name conform strictly to the TOSEC naming conventions.
This removes any warning tokens and ensures the order of flags is proper.
Fixes
- If there is no date, 19xx is added as the date.
- If there is no publisher, the unknown publisher (-) is added.
- GoodTools region codes are converted into the ISO equivalent.
- Publishers are sorted lexicographically.
- Tags are put in the order
Title version (demo) (date)(publisher)(system)(video)(country)(language) (copyright status)(development status)(media type)(media label) [cr][f][h][m][p][t][tr][o][u][v][b][a][!][more info]
- The date ‘19XX’ is changed into ‘19xx’.
- Uppercased development tags are lowercased.
Zero-copy guarantee
This method consumes the tokenized name and remains zero-copy.
The zero-copy nature of the parsed tokens mean that some fixes can not be done, such
as reorganizing individual publisher names into Surname, Given Name
format.
As a result, the strict name may not always conform to the strictest reading of the TOSEC naming convention, especially with regards to alphabetization or malformed flags that were not explicitly specified in listed fixes.
The fixes that are done are only possible by converting the tokenized &'a str
into
a known &'static str
.
Trait Implementations
sourceimpl<'a> From<Vec<TOSECToken<'a>, Global>> for TOSECName<'a>
impl<'a> From<Vec<TOSECToken<'a>, Global>> for TOSECName<'a>
sourcefn from(vec: Vec<TOSECToken<'a>>) -> Self
fn from(vec: Vec<TOSECToken<'a>>) -> Self
Performs the conversion.
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 TOSECName<'a>
impl<'a> StructuralEq for TOSECName<'a>
impl<'a> StructuralPartialEq for TOSECName<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for TOSECName<'a>
impl<'a> Send for TOSECName<'a>
impl<'a> Sync for TOSECName<'a>
impl<'a> Unpin for TOSECName<'a>
impl<'a> UnwindSafe for TOSECName<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more