pub struct SupportedGames { /* private fields */ }Expand description
Registry of all supported Total War games.
This struct maintains the complete list of games supported by RPFM along with their full configuration. It provides lookup by game key and maintains release order for UI sorting.
§Structure
games: HashMap for O(1) lookup by game keyorder: Vector maintaining games in release order (newest first)
§Usage
Create via Default::default() to get the full game registry:
use rpfm_lib::games::supported_games::{SupportedGames, KEY_WARHAMMER_3};
let games = SupportedGames::default();
// Lookup specific game
if let Some(game) = games.game(&KEY_WARHAMMER_3) {
println!("{}", game.display_name());
}
// Iterate all games in release order
for game in games.games_sorted() {
println!("{}", game.display_name());
}Implementations§
Source§impl SupportedGames
Implementation for SupportedGames.
impl SupportedGames
Implementation for SupportedGames.
Sourcepub fn game(&self, key: &str) -> Option<&GameInfo>
pub fn game(&self, key: &str) -> Option<&GameInfo>
Retrieves game information by key.
§Arguments
key- Game key constant (e.g.,KEY_WARHAMMER_3)
§Returns
Returns Some(&GameInfo) if the game is supported, None otherwise.
§Example
use rpfm_lib::games::supported_games::{SupportedGames, KEY_WARHAMMER_3};
let games = SupportedGames::default();
let game = games.game(&KEY_WARHAMMER_3).unwrap();
assert_eq!(game.key(), KEY_WARHAMMER_3);Sourcepub fn games(&self) -> Vec<&GameInfo>
pub fn games(&self) -> Vec<&GameInfo>
Returns all supported games in arbitrary order.
For games sorted by release date, use SupportedGames::games_sorted().
§Returns
Vector of references to all game configurations.
Sourcepub fn game_keys(&self) -> Vec<&str>
pub fn game_keys(&self) -> Vec<&str>
Returns all game keys in arbitrary order.
For keys sorted by release date, use SupportedGames::game_keys_sorted().
§Returns
Vector of game key strings.
Sourcepub fn games_sorted(&self) -> Vec<&GameInfo>
pub fn games_sorted(&self) -> Vec<&GameInfo>
Returns all supported games sorted by release date (newest first).
Use this when displaying games in UI to show them in chronological order.
§Returns
Vector of game references in release order.
Sourcepub fn game_keys_sorted(&self) -> &[&'static str]
pub fn game_keys_sorted(&self) -> &[&'static str]
Returns all game keys sorted by release date (newest first).
§Returns
Slice of game keys in release order.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SupportedGames
impl RefUnwindSafe for SupportedGames
impl Send for SupportedGames
impl Sync for SupportedGames
impl Unpin for SupportedGames
impl UnsafeUnpin for SupportedGames
impl UnwindSafe for SupportedGames
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.