pub trait PieceTrait: 'static + PieceBaseTrait + Downcast + Send + Debug + Serialize + Deserialize {
Show 14 methods fn svg_piece(
        &self,
        f: &mut Html,
        gpc: &GPiece,
        gs: &GameState,
        id: VisiblePieceId
    ) -> Result<(), InternalError>; fn describe_html(
        &self,
        gpc: &GPiece,
        _goccults: &GOccults
    ) -> Result<Html, InternalError>; fn add_ui_operations(
        &self,
        _y: ShowUnocculted,
        _upd: &mut Vec<UoDescription, Global>,
        _gs: &GameState,
        _gpc: &GPiece
    ) -> Result<(), InternalError> { ... } fn ui_operation(
        &self,
        _y: ShowUnocculted,
        _a: ApiPieceOpArgs<'_>,
        _opname: &str,
        _wrc: WhatResponseToClientOp
    ) -> Result<OpOutcomeThunkGeneric<(PlayerId, PieceId), (PieceUpdate, Vec<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>, Global>), ApiPieceOpError>, ApiPieceOpError> { ... } fn ui_permit_flip(&self, _gpc: &GPiece) -> Result<bool, ApiPieceOpError> { ... } fn held_change_hook(
        &self,
        _ig: &InstanceRef,
        _gplayers: &DenseSlotMap<PlayerId, GPlayer>,
        _ipieces: &IPieces,
        _goccults: &GOccults,
        _gpieces: &mut GPieces,
        _tpiece: PieceId,
        _was_held: Option<PlayerId>
    ) -> Result<OpOutcomeThunkGeneric<(PlayerId,), Vec<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>, Global>, InternalError>, InternalError> { ... } fn save_reloaded_hook(
        &self,
        _piece: PieceId,
        _gs: &mut GameState,
        _ig: &InstanceRef
    ) -> Result<(), InternalError> { ... } fn loaded_hook_preview(
        &self,
        _gpc: &mut GPiece
    ) -> Result<(), InternalError> { ... } fn bbox_preview(&self) -> Result<RectC<i32>, InternalError> { ... } fn delete_hook(
        &self,
        _p: &GPiece,
        _gs: &mut GameState
    ) -> ExecuteGameChangeUpdates { ... } fn sortkey(&self) -> Option<&str> { ... } fn occultation_notify_hook(
        &self,
        _piece: PieceId
    ) -> Vec<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>, Global>Notable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
    A: Allocator
{ ... } fn op_multigrab(
        &self,
        _a: ApiPieceOpArgs<'_>,
        _show: ShowUnocculted,
        _qty: u32,
        _new_z: ShouldSetZLevel
    ) -> Result<OpOutcomeThunkGeneric<(PlayerId, PieceId), (PieceUpdate, Vec<Box<dyn FnOnce(&'r mut PrepareUpdatesBuffer<'_>) + 'static, Global>, Global>), ApiPieceOpError>, ApiPieceOpError> { ... } fn abs_bbox(&self, p: &GPiece) -> Result<RectC<i32>, InternalError> { ... }
}

Required Methods

Provided Methods

Can return false to mean “I will handle it in ui_operation”

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.

Implementations

Returns true if the trait object wraps an object of type __T.

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Trait Implementations

Deserialize this value from the given Serde deserializer. Read more

Deserialize this value from the given Serde deserializer. 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

Serialize this value into the given Serde serializer. Read more

Implementors