Skip to main content

RenderData

Trait RenderData 

Source
pub trait RenderData {
    type Move: Copy + Eq + Debug;
    type Item: Copy + Eq + Debug;
    type Species: Copy + Eq + Debug;

    // Required methods
    fn move_name(&self, m: Self::Move) -> &str;
    fn move_pp(&self, m: Self::Move) -> (u8, u8);
    fn move_type(&self, m: Self::Move) -> u8;
    fn item_name(&self, i: Self::Item) -> &str;
    fn species_name(&self, s: Self::Species) -> &str;
}
Expand description

Provides render-time string and metadata lookups for game entities.

This trait abstracts the display layer so that the UI and renderer can query move names, item names, species names, and move metadata without depending on concrete data types. This enables the engine to remain generic across different RPG games.

Required Associated Types§

Source

type Move: Copy + Eq + Debug

The type representing a move (ability/skill) in the game.

Source

type Item: Copy + Eq + Debug

The type representing an item in the game.

Source

type Species: Copy + Eq + Debug

The type representing a species (monster/character type) in the game.

Required Methods§

Source

fn move_name(&self, m: Self::Move) -> &str

Returns the display name of a move.

Source

fn move_pp(&self, m: Self::Move) -> (u8, u8)

Returns the PP (power points) for a move as (current_max, base_max).

Some moves have PP that can be boosted beyond their base value (e.g., via PP Up items), so both values are returned.

Source

fn move_type(&self, m: Self::Move) -> u8

Returns the type ID (element/attribute) of a move.

Source

fn item_name(&self, i: Self::Item) -> &str

Returns the display name of an item.

Source

fn species_name(&self, s: Self::Species) -> &str

Returns the display name of a species.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§