Skip to main content

MapUnit

Trait MapUnit 

Source
pub trait MapUnit {
    type Id: Copy + PartialEq;

    // Required methods
    fn id(&self) -> Self::Id;
    fn pos(&self) -> Pos;
    fn text(&self) -> String;
}
Expand description

What a scene needs of a game’s view of a unit: which unit it is, the tile it is shown on, and its line in the scene’s text.

Required Associated Types§

Source

type Id: Copy + PartialEq

What tells units apart.

Required Methods§

Source

fn id(&self) -> Self::Id

Which unit it is.

Source

fn pos(&self) -> Pos

The tile it is shown on.

Source

fn text(&self) -> String

Its line in MapScene::to_text: everything about it a test or a bug report needs, the same for the same unit.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§