pub struct TypeRegistry;Expand description
Global registry of type lists loaded from TypeLists.txt.
Mirrors Java’s CardType.Constant.CREATURE_TYPES etc., populated once by
FModel.loadDynamicGamedata() → CardType.Helper.parseTypes().
Call TypeRegistry::load once at startup with the contents of
TypeLists.txt. All subsequent calls to TypeRegistry::creature_types
return the loaded data without any per-game copying.
Implementations§
Source§impl TypeRegistry
impl TypeRegistry
Sourcepub fn load(type_lists_content: &str)
pub fn load(type_lists_content: &str)
Load creature types from the raw contents of TypeLists.txt.
Parses the [CreatureTypes] section. Each line is either TypeName or
TypeName:PluralName; only the singular (left of :) is kept.
Mirrors Java’s FileSection.parseSections() + CardType.Helper.parseTypes().
This must be called once before any game starts. Subsequent calls are silently ignored (first write wins).
Sourcepub fn creature_types() -> &'static [String]
pub fn creature_types() -> &'static [String]
Sourcepub fn is_creature_type(creature_type: &str) -> bool
pub fn is_creature_type(creature_type: &str) -> bool
Return whether creature_type is a known creature subtype.
Unlike TypeRegistry::creature_types, this is safe to call in unit
tests that haven’t loaded type data yet; it simply returns false.