Trait otter::gamestate::PieceTrait[][src]

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

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