Trait otter_api_tests::PieceTrait[][src]

pub trait PieceTrait: 'static + OutlineTrait + Send + Debug + Serialize + Deserialize {
    fn nfaces(&self) -> u8;
fn svg_piece(
        &self,
        f: &mut Html,
        gpc: &GPiece,
        gs: &GameState,
        id: VisiblePieceId
    ) -> Result<(), InternalError>;
fn describe_html(
        &self,
        gpc: &GPiece,
        _goccults: &GameOccults
    ) -> Result<Html, InternalError>;
fn itemname(&self) -> &str; fn add_ui_operations(
        &self,
        ShowUnocculted,
        _upd: &mut Vec<UoDescription, Global>,
        _gs: &GameState,
        _gpc: &GPiece
    ) -> Result<(), InternalError> { ... }
fn ui_operation(
        &self,
        ShowUnocculted,
        _a: ApiPieceOpArgs<'_>,
        _opname: &str,
        _wrc: WhatResponseToClientOp
    ) -> Result<(PieceUpdate, Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>), ApiPieceOpError> { ... }
fn held_change_hook(
        &self,
        _ig: &InstanceRef,
        _gpieces: &mut GPieces,
        _piece: PieceId,
        _was_held: Option<PlayerId>
    ) -> Result<Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>>, InternalError> { ... }
fn loaded_hook(
        &self,
        _piece: PieceId,
        _gs: &mut GameState,
        _ig: &InstanceRef
    ) -> Result<(), InternalError> { ... }
fn delete_hook(
        &self,
        _p: &GPiece,
        _gs: &mut GameState
    ) -> ExecuteGameChangeUpdates { ... }
fn sortkey(&self) -> Option<&str> { ... }
fn occultation_notify_hook(
        &self,
        _piece: PieceId
    ) -> Option<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>> { ... }
fn abs_bbox(&self, p: &GPiece) -> Result<RectC<i32>, InternalError> { ... } }

Required methods

by convention, occult face is nfaces-1

Provided methods

Piece is responsible for dealing with the possibility that they may be occulted!

Not called if the whole game is destroyed. You can use Drop of course but it’s not usually much use since you don’t have a reference to the game or anything.

Trait Implementations

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Serialize this value into the given Serde serializer. Read more

Implementors